Hello everyone,
I have the following setup:
- HA Slave: Raspi Zero that “collects” data from a Mi hygrometer via BT
- HA Master: Raspi 3B as main instance with the used frontend and all automations etc
Both are connected via the MQTT eventstream.
I can see the data of the Mi hygrometer at my master. But everytime i open the frontend I get the warning that the Mi hygrometer entity from the slave is not available:
After ~15s, or I guess the time until my master receives the next MQTT update from the slave, it is displayed correctly:
Why is there a “Lag” like this? I would assume that Home Assistant saves the last state and can display it when I’m opening the frontend view, since my recorder is activated.
On the other hand the 24h graph is working. So the recorder has the old data of the sensor.
This leads my to my second problem: I can’t use the state of the Mi hygrometer in any automation.
In the entities overview it is listed as sensor.bathroom_hygrometer_humidity
with the displayed value. But accessing states.sensor.bathroom_hygrometer_humidity
in templates fails and it says it is not defined.
In conclusion I assume that eventstream state is not persisted anywhere in the master, but then it’s useless…!?
Am i missing anything?
Slave Config
mqtt_eventstream:
publish_topic: homeassistant-slaves/upper
subscribe_topic: homeassistant/master
# Sensors
sensor:
- platform: mitemp_bt
name: Bathroom Hygrometer
mac: !secret bt_bathroom_hygro
monitored_conditions:
- temperature
- humidity
- battery
force_update: true
median: 3
timeout: 15
Master Config
mqtt_eventstream:
publish_topic: homeassistant/master
subscribe_topic: homeassistant-slaves/#
ignore_event:
- call_service
- state_changed
- alias: Badezimmer Luftfeuchtigkeit
trigger:
platform: template
value_template: "{% if states.sensor.bathroom_hygrometer_humidity and ((states.sensor.bathroom_hygrometer_humidity.state|float) > 55 or (states.sensor.bathroom_hygrometer_humidity.state|float) < 35) %}true{% endif %}"
action:
service: notify.telegram_group
data:
title: 'Bitte das *Badezimmer* lüften!'
message: 'Die Luftfeuchtigkeit liegt mit einem Wert von *{{ states.sensor.bathroom_hygrometer_humidity.state }}%* außerhalb des Grenzbereichs.'