I don’t see anything wrong with this. The problem must lie elsewhere in your configuration.
really thanks a lot for all the help that you give to me!!! where i can search to find some other problem?
do you know if the sensor take some time before update? for example
Closed - Open - Closed - Take Some Minutes before open again.
The template binary sensors will update immediately when the referenced entities (sensor.0x00158d0002b1136c_action
and sensor.0x00158d0002af6ac2_action
, respectively) update.
If you see warnings or errors in the log, you need to address those. Otherwise, look in the log for updates to those sensors and see how the template binary sensors respond. You can look in the Logbook, or better yet, in home-assistant.log, but you’ll need to set up debugging output:
logger:
default: info
logs:
homeassistant.core: debug
Or just watch the entities on the States page.
I really can’t provide more specific suggestions because you’ve not provided much detail about what’s happening.
i’m trying to search something… i will post some image… i don’t have any log error about the binary sensor…
But for example at 18:52 my Vibration sensor is vibration and the binary sensor in ON, after 5 minutes the binary sensor is OFF, correct, at 19:06 Vibration sensor is vibration but the binary sensor stay OFF…
I have found this in the log i don’t know if can help:
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:12:21.007058+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:12:21.007058+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_battery, old_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>, new_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_linkquality, old_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>, new_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:12:21.007058+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.847557+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.847557+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.847557+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_battery, old_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>, new_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_linkquality, old_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>, new_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>>
2019-10-02 19:16:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.847557+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.944809+02:00>>
2019-10-02 19:16:57 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=battery_sensor_from_attributes, entity_id=automation.battery_sensor_from_attributes>
2019-10-02 19:16:57 INFO (MainThread) [homeassistant.components.automation] Executing battery_sensor_from_attributes
2019-10-02 19:16:57 INFO (MainThread) [homeassistant.helpers.script] Script battery_sensor_from_attributes: Executing step call service
2019-10-02 19:16:57 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=mqtt, service=publish, service_data=topic=homeassistant/sensor/0x00158d0002b1136c_action_battery/config, retain=True, payload={
"name": "Finestra Studio Battery",
"state_topic": "homeassistant/sensor/0x00158d0002b1136c_action_battery/state",
"value_template": "{{ value_json.value | int }}",
"unit_of_measurement": "%",
"device_class": "battery",
"unique_id": "0x00158d0002b1136c_action_battery",
"json_attributes_topic": "homeassistant/sensor/0x00158d0002b1136c_action_battery/attributes"
}>
2019-10-02 19:16:57 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=battery_sensor_from_attributes, entity_id=automation.battery_sensor_from_attributes>
And now i have take the log that has worked:
2019-10-02 19:25:38 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event timer_out_of_sync[L]: seconds=1.9044663439854048>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.944809+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.944809+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_battery, old_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>, new_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_linkquality, old_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>, new_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:16:56.944809+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:25:53.369515+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:25:53.369515+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:25:53.369515+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_battery, old_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>, new_state=<state sensor.0x00158d0002b1136c_battery=100; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, unit_of_measurement=%, friendly_name=Finestra Studio, device_class=battery @ 2019-10-02T19:12:21.023761+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_linkquality, old_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=vibration, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>, new_state=<state sensor.0x00158d0002b1136c_linkquality=126; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, unit_of_measurement=-, friendly_name=Finestra Studio @ 2019-10-02T19:12:21.037170+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.0x00158d0002b1136c_action, old_state=<state sensor.0x00158d0002b1136c_action=vibration; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:25:53.369515+02:00>, new_state=<state sensor.0x00158d0002b1136c_action=; linkquality=126, battery=100, voltage=3015, angle=5, angle_x=-2, angle_y=75, angle_z=14, angle_x_absolute=92, angle_y_absolute=15, action=, friendly_name=Finestra Studio, icon=mdi:gesture-double-tap @ 2019-10-02T19:25:53.504463+02:00>>
2019-10-02 19:25:53 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.finestra_studio, old_state=<state binary_sensor.finestra_studio=off; friendly_name=Finestra Studio, device_class=window @ 2019-10-02T19:08:24.859958+02:00>, new_state=<state binary_sensor.finestra_studio=on; friendly_name=Finestra Studio, device_class=window @ 2019-10-02T19:25:53.530647+02:00>>
Which Xiaomi sensor are you using? I want a tilt sensor and thought maybe the Aqara vibration sensor would have this but I don’t have any tilt attributes.
I have used Zigbee2MQTT to add to HomeAssistant.
Probably if you used the Xiaomi Hub don’t have some parameters
Did your template sensor work?
The delay_off option is available in the mqtt sensor. I didn’t see it in the template documents
yes, my config now work.
thank you for your feedback
No problem, if you need more info ask me