hi all,
I’m fairly new to home Assistant… so apologies if I missed something quite obvious… I’ve searched through the forum without finding a previous or similar issue and all examples look straight forward. but i still can’t seem to trigger the light to come on upon motion being detected. Home Assistant can see my Philips hue motion sensor and is recorded in the log file when motion is detected. So I’ve started from the beginning again using the below config. rather than splitting out to scripts/ and automation/ if reverted back to using in the configuration.yaml.
automation:
alias: Motion Bathroom Light on
trigger:
- platform: state
entity_id: sensor.landing_motion_binary
to: ‘true’
action:
service: script.turn_on
entity_id: script.timed_light
script:
timed_light:
alias: “Turn on light and set timer”
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.timer_off
- service: light.turn_on
data:
entity_id: light.bathroom
# Set new timer
- service: script.turn_on
data:
entity_id: script.timer_off
timer_off:
alias: “Turn off light after 1 minute - testing purposes”
sequence:
- delay:
minutes: 1
- service: light.turn_off
data:
entity_id: light.bathroom
below is the entry in my sensors.yaml
- platform: rest
resource: !secret rest_motion1
value_template: ‘{{ value_json.state.presence }}’
scan_interval: 2
name: ‘Landing Motion Binary’
the below is the entry in home-assistant.log
16-12-27 18:12:58 homeassistant.loader: Loaded automation.state from homeassistant.components.automation.state
16-12-27 18:12:58 homeassistant.bootstrap: Setting up automation
16-12-27 18:12:58 homeassistant.components.automation: Initialized trigger Motion Bathroom Light on
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state automation.motion_bathroom_light_on=on; friendly_name=Motion Bathroom Light on, last_triggered=None @ 2016-12-27T18:12:58.023760+00:00>, entity_id=automation.motion_bathroom_light_on>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state group.all_automations=on; auto=True, friendly_name=all automations, order=18, entity_id=(‘automation.motion_bathroom_light_on’,), hidden=True @ 2016-12-27T18:12:58.027040+00:00>, entity_id=group.all_automations>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=automation, service=trigger>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=automation, service=reload>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=automation, service=toggle>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=automation, service=turn_on>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=automation, service=turn_off>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=automation>
16-12-27 18:12:58 homeassistant.bootstrap: Setting up script
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=script, service=timer_off>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=script, service=timed_lamp>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state script.timer_off=off; friendly_name=Turn off lamp after 10 minutes, can_cancel=True @ 2016-12-27T18:12:58.079180+00:00>, entity_id=script.timer_off>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state script.timed_lamp=off; friendly_name=Turn on lamp and set timer @ 2016-12-27T18:12:58.081179+00:00>, entity_id=script.timed_lamp>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state group.all_scripts=off; auto=True, friendly_name=all scripts, order=19, entity_id=(‘script.timed_lamp’, ‘script.timer_off’), hidden=True @ 2016-12-27T18:12:58.084189+00:00>, entity_id=group.all_scripts>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=script, service=turn_on>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=script, service=turn_off>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event service_registered[L]: domain=script, service=toggle>
16-12-27 18:12:58 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=script>
The last few lines write to the log file as motion is detected
16-12-27 18:34:56 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=<state sensor.landing_motion_binary=False; friendly_name=Landing Motion Binary @ 2016-12-27T18:14:22.533997+00:00>, new_state=<state sensor.landing_motion_binary=True; friendly_name=Landing Motion Binary @ 2016-12-27T18:34:56.534222+00:00>, entity_id=sensor.landing_motion_binary>
16-12-27 18:35:08 netdisco.service: Scanning
16-12-27 18:35:14 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=<state sensor.landing_motion_binary=True; friendly_name=Landing Motion Binary @ 2016-12-27T18:34:56.534222+00:00>, new_state=<state sensor.landing_motion_binary=False; friendly_name=Landing Motion Binary @ 2016-12-27T18:35:14.534354+00:00>, entity_id=sensor.landing_motion_binary>
16-12-27 18:35:30 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=<state sun.sun=below_horizon; friendly_name=Sun, next_setting=2016-12-28T16:13:41+00:00, elevation=-19.7, azimuth=257.19, next_rising=2016-12-28T08:38:34+00:00 @ 2016-12-27T18:12:42.894947+00:00>, new_state=<state sun.sun=below_horizon; friendly_name=Sun, next_setting=2016-12-28T16:13:41+00:00, elevation=-19.85, azimuth=257.37, next_rising=2016-12-28T08:38:34+00:00 @ 2016-12-27T18:12:42.894947+00:00>, entity_id=sun.sun>
Triggering the automation in Home Assistant will turn on the light and it will turn off in 1 minute. But motion via th sensor is not working.
Any help / suggestions will be very welcome. I’ve been on this for the 2 days and losing my hair…