Setting-up Home Assistant

From Eric

(Difference between revisions)
Jump to: navigation, search
m (Created page with "= Discovery = * For devices to be automatically discovered by Home Assistant, their configuration must be published as shown below (for an ESP32 Arduino platform): Serial.pri...")
m
Line 15: Line 15:
   client.publish("homeassistant/sensor/mto1_vbat/config",  
   client.publish("homeassistant/sensor/mto1_vbat/config",  
     "{\"unique_id\": \"mto1_vbat\", \"name\": \"mto1_vbat\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"V\", \"val_tpl\": \"{{ value_json.vbat}}\"}" ) ;}
     "{\"unique_id\": \"mto1_vbat\", \"name\": \"mto1_vbat\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"V\", \"val_tpl\": \"{{ value_json.vbat}}\"}" ) ;}
 +
 +
The corresponding JSON message for the pressure is the following:
 +
{"unique_id": "mto1_p", "dev_cla": "pressure", "name": "mto1_p", "stat_t": "tele/lorabridge/mto1", "unit_of_meas": "Pa", "val_tpl": "{{ value_json.p}}"}
Here, I have used the abbreviated attributes names.
Here, I have used the abbreviated attributes names.
 +

Revision as of 11:30, 15 July 2022

Contents

Discovery

  • For devices to be automatically discovered by Home Assistant, their configuration must be published as shown below (for an ESP32 Arduino platform):
  Serial.println("Sending discovery data: ");
  client.publish("homeassistant/sensor/mto1_t1/config", 
    "{\"unique_id\": \"mto1_t1\", \"dev_cla\": \"temperature\", \"name\": \"mto1_t1\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"°C\", \"val_tpl\": \"Template:Value json.t1\"}" ) ;   
  client.publish("homeassistant/sensor/mto1_t2/config", 
    "{\"unique_id\": \"mto1_t2\", \"dev_cla\": \"temperature\", \"name\": \"mto1_t2\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"°C\", \"val_tpl\": \"Template:Value json.t2\"}" ) ;          
  client.publish("homeassistant/sensor/mto1_h/config", 
    "{\"unique_id\": \"mto1_h\", \"dev_cla\": \"humidity\", \"name\": \"mto1_h\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"%\", \"val_tpl\": \"Template:Value json.h\"}" ) ;     
  client.publish("homeassistant/sensor/mto1_p/config", 
    "{\"unique_id\": \"mto1_p\", \"dev_cla\": \"pressure\", \"name\": \"mto1_p\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"Pa\", \"val_tpl\": \"Template:Value json.p\"}" ) ;
  client.publish("homeassistant/sensor/mto1_a/config", 
    "{\"unique_id\": \"mto1_a\", \"name\": \"mto1_a\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"m\", \"val_tpl\": \"Template:Value json.a\"}" ) ;
  client.publish("homeassistant/sensor/mto1_vbat/config", 
    "{\"unique_id\": \"mto1_vbat\", \"name\": \"mto1_vbat\", \"stat_t\": \"tele/lorabridge/mto1\", \"unit_of_meas\": \"V\", \"val_tpl\": \"Template:Value json.vbat\"}" ) ;}

The corresponding JSON message for the pressure is the following: {"unique_id": "mto1_p", "dev_cla": "pressure", "name": "mto1_p", "stat_t": "tele/lorabridge/mto1", "unit_of_meas": "Pa", "val_tpl": "Template:Value json.p"}

Here, I have used the abbreviated attributes names.


Node Red

Node Red for RF switches

Node Red for Ikea switches

Personal tools