[DOCS] Modify home assistant configuration changes to reflect MQTT syntax that is required since HomeAssistant 2022.12.0 (#1511)

The MQTT YAML configuration change was optional in 2022.6, but the new syntax (updated above) is now mandatory, and now matches the already updated documentation provided at the top of the page.  I also added the force_update flag to help with the expire_after to give better graphing of temperature/humidity readings.
This commit is contained in:
Yogotech's GITHub account authored and GitHub committed 2023-03-08 05:25:12 -06:00
1 parent 8f47a80303
commit 2a8257d4ce
1 file changed
+35 -37
+35 -37
View File
@@ -81,9 +81,9 @@ From @123, @finity, @denniz03, @jrockstad, @anarchking, @dkluivingh
### Door sensor
```yaml
binary_sensor:
- platform: mqtt
name: "test"
mqtt:
binary_sensor:
- name: "test"
state_topic: "home/OpenMQTTGateway/433toMQTT"
value_template: >-
{% if value_json.value == '7821834' %}
@@ -98,9 +98,9 @@ binary_sensor:
```
```yaml
binary_sensor:
- platform: mqtt
name: doorbell
mqtt:
binary_sensor:
- name: doorbell
state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
#value_template: "{{ value_json.raw }}"
value_template: >-
@@ -111,9 +111,8 @@ binary_sensor:
{% endif %}
off_delay: 30
device_class: 'sound'
- binary_sensor:
platform: mqtt
name: light_back_sensor
- name: light_back_sensor
state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
#value_template: '{{ value_jason.value }}'
value_template: >-
@@ -123,9 +122,8 @@ binary_sensor:
{{states('binary_sensor.light_back_sensor') | upper}}
{% endif %}
off_delay: 5
- binary_sensor:
platform: mqtt
name: rf_outlet_sensor
- name: rf_outlet_sensor
state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
value_template: >-
{% if value_json.value == '16766303' %}
@@ -137,9 +135,9 @@ binary_sensor:
### Motion sensor
```yaml
binary_sensor:
- platform: mqtt
name: "Bewegung_Schlafzimmer"
mqtt:
binary_sensor:
- name: "Bewegung_Schlafzimmer"
#device_class: motion
state_topic: "home/OpenMQTTGateway1/HCSR501toMQTT"
value_template: '{{ value_json["presence"] }}'
@@ -151,9 +149,9 @@ binary_sensor:
```yaml
#switches
switch:
- platform: mqtt
name: Plug1
mqtt:
switch:
- name: Plug1
state_topic: "home/OpenMQTTGateway/SRFBtoMQTT"
command_topic: "home/OpenMQTTGateway/commands/MQTTtoSRFB"
value_template: "{{ value_json.value }}"
@@ -168,49 +166,49 @@ switch:
### Mijia Thermometer BLE
```yaml
Sensor:
- platform: mqtt
mqtt:
sensor:
- name: "mijia_thermometer_temperature"
state_topic: 'home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA' # MQTT topic, check MQTT messages; replace AA... with id (BLE MAC) of your device
name: "mijia_thermometer_temperature"
unit_of_measurement: '°C'
value_template: '{{ value_json.tem | is_defined }}'
expire_after: 21600 # 6 hours
- platform: mqtt
force_update: true
- name: "mijia_thermometer_humidity"
state_topic: 'home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA'
name: "mijia_thermometer_humidity"
unit_of_measurement: '%'
value_template: '{{ value_json.hum | is_defined }}'
expire_after: 21600 # 6 hours
- platform: mqtt
force_update: true
- name: "mijia_thermometer_battery"
state_topic: 'home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA'
name: "mijia_thermometer_battery"
unit_of_measurement: '%'
value_template: '{{ value_json.batt | is_defined }}'
expire_after: 21600 # 6 hours
```
force_update: true
```
### Xiaomi Mi Scale V2 BLE (XMTZC05HM)
```yaml
sensor:
- platform: mqtt
name: "Weight"
mqtt:
sensor:
- name: "Weight"
state_topic: "home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA" # replace your MQTT topic here
value_template: '{{ value_json["weight"] }}'
unit_of_measurement: "kg"
icon: mdi:weight-kilogram
- platform: mqtt
name: "Impedance"
- name: "Impedance"
state_topic: "home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA" # replace your MQTT topic here also
value_template: '{{ value_json["impedance"] }}'
unit_of_measurement: "Ohm"
icon: mdi:omega
- platform: template
sensors:
body_mass_index:
template:
sensor:
- name: body_mass_index:
friendly_name: 'Body Mass Index'
value_template: >-
{% set HEIGHT = (1.76)|float %} # replace your height in meters
@@ -237,9 +235,9 @@ sensor:
### Temperature sensor
```yaml
sensor:
- platform: mqtt
name: outdoor temp
mqtt:
sensor:
- name: outdoor temp
state_topic: "home/OpenMQTTGateway/433toMQTT"
unit_of_measurement: '°C'
value_template: >