rtl_433+MQTT weather station - why outdoor and indoor values display alternately

Sorry, I’m new to Home Assistant. I have 433mhz weather station sensors, indoor and outdoor, which I can read the data transmitted from them by using rtl_433 app (on Ubuntu, HASSIO,). Json data from outdoor and indoor sensors received and published to mqtt every 16s and 60s, respectively.

The data displayed on Home screen are indoor temp, indoor humidity, indoor pressure, and outdoor temp.

The problem is while the outdoor temp value displaying, all the indoor values disappears. When the indoor values display, the outdoor value disappear. The seem to come and go according to the new values received from the sensors.

My question is how to keep all indoor and outdoor values displaying all the time.

I attached screenshot of the home display and my configuration on that part for reference here.
Thank you for assistance.

The answer is simple and is due to the way you have created the value_template and the fact all sensors are subscribed to the same topic.

The topic is home/rtl_433 and it contains all sensor values but not all at the same time. At one moment, it has a value for sensor1, the moment the value is for sensor2, etc.

Each sensor’s value_template checks if the topic’s payload is intended for it (value_json.id == 247).

  • If it is, it uses the payload’s value.
  • If it’s not, in other words it’s a value for another sensor, the template does … nothing. No value is returned. There’s your problem.

The template for sensor.indoor_temp should look like this:

{% if value_json is defined and value_json.id == 247 %}
  {{ value_json.humidity }}
{% else %}
  {{ states('sensor.indoor_temp') }}
{% endif %}

When the received payload is not intended for the sensor, the template simply returns the sensor’s existing value.

I recommend you review Strategy 1 in the following post:

Although I wrote it for the Sonoff RF Bridge, the principles remain the same (namely how to handle the situation when multiple sensors all use the same MQTT topic).


EDIT
Corrected typos and formatting.

1 Like

Hi,

Thanks a lot for your help.

It works great now.

Hi,

came across this post after starting my rtl_433 integration of my acurite weather station. Here is my dilema:

  1. I have the same problem as the OP, but I am only using the outdoor station. I get 2 different sets of data ever few seconds.
    post card 2
    and
    post card 3

  2. here is my sensor.yaml

I don’t have the unique identify that the OP has. What should I be doing to keeps these values displaying until they update?

I figured it out from this site:
http://blog.techreverence.com/autostart-rtl_433-with-supervisor.html

changed the cmd to start rtl_433 to:

rtl_433 -F “mqtt://192.168.X.X:1883,user=your username,pass=your password,retain=0,devices=rtl_433[/model][/id]”

now each topic has the id included

2 Likes