I’ve been using rtl_433 and MQTT to capture data from a bunch of sensors from different manufacturers, and now have an issue with my AmbientWeather floating pool thermometer. For some reason, it now seems to randomly change the unit id, so I need to process the value based on the channel instead of the unit id.
Here is the old date from MQTT Explorer:
Ambientweather-F007TH
219 = {“time”:“2022-07-04 08:42:24”,“model”:“Ambientweather-F007TH”,“id”:219,“channel”:1,“battery_ok”:1,“temperature_F”:88.34,“humidity”:43,“mic”:“CRC”}
I changed the channel in the sensor to “8” from “1”, in order to distinguish it from some next door devices.
Here is the new data from MQTT Explorer:
Ambientweather-F007TH
187 = {“time”:“2022-07-14 14:05:43”,“model”:“Ambientweather-F007TH”,“id”:187,“channel”:8,“battery_ok”:1,“temperature_F”:79.3,“humidity”:44,“mic”:“CRC”}
Here is what had been working when the unit id was “219”:
- platform: mqtt
state_topic: "rtl_433/Ambientweather-F007TH/219"
name: "Pool: Floating Temperature"
unit_of_measurement: "°F"
force_update: true
value_template: '{{ value_json.temperature_F | round(1) }}'
I’m wanting to do something like this:
- platform: mqtt
state_topic: "rtl_433/Ambientweather-F007TH/<<any value here>>"
name: "Pool: Floating Temperature"
unit_of_measurement: "°F"
force_update: true
value_template: >
{% if value_json.channel = 8 %}
{{ value_json.temperature_F | round(1) }}
{% else %}
{{ states('sensor.pool_floating_temperature') }}
{% endif %}
I just have average coding skills, so need help getting this formatted correctly so that it will work.