Dear community,
I recently implemented the direct hack on my Sonoff RF Bridge to enable it to recieve RF thermometers and so on.
After flashing OpenMQTTGateway, this is working quite well. I recieve data from my doorbell and a digoo thermostat. I then checked several posts here andstole me some examples on how to configure my MQTT sensors, however not everything works as expected. While HA becomes more and more drag and drop and gui configurable, I wonder when there will be a way to easily click together sensors from MQTT data
I used MQTTbox on my PC and subscribed the topic (from MQTT broker running on HA) to check of everything is working and it looks fine. Please note that all devices use the same topic - that seems to be by design.
Doorbell MQTT:
{"message":{"id":"E7","unit":23,"state":"off"},"protocol":"clarus_switch","length":"E7","value":"E7","repeats":5,"status":2}
**qos** : 0, **retain** : false, **cmd** : publish, **dup** : false, **topic** : home/SRFBgate/PilighttoMQTT, **messageId** : , **length** : 153
got it easily working like this:
binary_sensor:
- platform: mqtt
name: rfbell
state_topic: 'home/SRFBgate/PilighttoMQTT'
#value_template: "{{ value_json.raw }}"
value_template: >-
{% if value_json.value == 'E7' %}
{{'ON'}}
{% else %}
{{states('binary_sensor.rfbell') | upper}}
{% endif %}
off_delay: 5
Next the digoo, it has temperature and humidity, but for testing I just tried it with temp. MQTT:
{"message":{"id":89,"channel":0,"battery":1,"temperature":21.6,"humidity":28},"protocol":"nexus","length":"89","value":"89","repeats":2,"status":2}
**qos** : 0, **retain** : false, **cmd** : publish, **dup** : false, **topic** : home/SRFBgate/PilighttoMQTT, **messageId** : , **length** : 176
My try for the sensor (in my sensors.yaml):
- platform: mqtt
state_topic: "home/SRFBgate/PilighttoMQTT"
name: "Aussentemperatur"
unit_of_measurement: "°C"
value_template: >
{% if value_json.value == '89' %}
{{ value_json.temperature }}
{% else %}
{{ states('sensor.aussentemperatur') }}
{% endif %}
Result: the sensor will appear, but always show 0°C, never the submitted value.
Can anybody see what I am doing wrong?
Thank you in advance!