@haaeff wrote:
Hi. I have, after a lot of reading and a lot of HA restarts, managed to get a binary sensor working.
However it is unclear to me if the manually configured sensor should show in HA gui under Entities or not?
Sensor definition in configuration.yaml:binary_sensor: - platform: mqtt name: "kerui1" device_class: motion state_topic: "homeassistant/sonoffrf/RESULT" value_template: "{{value_json.RfReceived.Data}}" payload_on: "81622A" off_delay: 2
Checking log file for sensor name show that the sensor is active:
tail -f /usr/share/hassio/homeassistant/home-assistant.log | grep kerui 2020-02-05 21:11:42 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.kerui1, old_state=<state binary_sensor.kerui1=off; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:11.937570+01:00>, new_state=<state binary_sensor.kerui1=on; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:42.242433+01:00>> 2020-02-05 21:11:42 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2915650672] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=binary_sensor.kerui1, old_state=<state binary_sensor.kerui1=off; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:11.937570+01:00>, new_state=<state binary_sensor.kerui1=on; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:42.242433+01:00>>} 2020-02-05 21:11:45 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=binary_sensor.kerui1, old_state=<state binary_sensor.kerui1=on; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:42.242433+01:00>, new_state=<state binary_sensor.kerui1=off; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:45.004834+01:00>> 2020-02-05 21:11:45 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2915650672] Sending {'id': 2, 'type': 'event', 'event': <Event state_changed[L]: entity_id=binary_sensor.kerui1, old_state=<state binary_sensor.kerui1=on; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:42.242433+01:00>, new_state=<state binary_sensor.kerui1=off; friendly_name=kerui1, device_class=motion @ 2020-02-05T21:11:45.004834+01:00>>}
And I can use the sensor for light automation (from automations.yaml):
- alias: Turn on kitchen light when there is movement trigger: platform: state entity_id: binary_sensor.kerui1 to: 'on' action: service: light.turn_on entity_id: light.hue_white_lamp_4 - alias: Turn off kitchen light 10 minutes after last movement trigger: platform: state entity_id: binary_sensor.kerui1 to: 'off' for: minutes: 1 action: service: light.turn_off entity_id: light.hue_white_lamp_4
It took me some hours of work before I checked the home-assistant.log, I wanted to get my own defined sensor to show in gui. Can anyone enlighten me on this topic?
Br Hans Fredrik
Posts: 4
Participants: 3