can it work? looks simple but if it works, its much better
i do understand the code, but what i dont understand, if motion is detected in deconz already, why/how should it send motion detection again? does deconz actually receive a new signal after 6 seconds?
if so, why is there no option in deconz to configure motion off after 5/6 seconds?
I tried it. My sensor did reset the state to off correctly. But after that the sensor stays off.
In the comments more people had this problem. The video is now offline. Hopefully the maker of this hack will fix this problem. I really found it a cool hack without soldering or modifying the hardware.
well i tried it also
with the rest command, i put the state to “off”, thats nothing special
but in video, he talked that after 6 seconds, he was able to send a motion again
for me it was not 6 , but i needed to wait like 40 seconds, before it triggered motion again
I don’t have conbee, I use zigbee2mqtt. But the information is not for conbee or zigbee2mqtt, the information is for homeassistant. It should work in both zigbee2mqtt and conbee
No, is not the hardware that should be able to send the state back… Is the automation that send a json code to force the entity to go “off state”. Said that, the pir sensor is not consuming more power and continue to work like before. The state change is forced by homeassistant, not by hardware
Setting the state to “off” that’s indeed rest command, not hardware… It’s just setting a state … No big deal here…
So when state is off… The new “motion detected” is coming from the xiaomi, to deconz to, home assistant setting the binary state to “on” again… So in my opinion that’s the deconz hardware that’s sending the new event… So that’s hardware (conbee) related?
Think you are wrong. I tried to see the zigbee2mqtt logs to identify the sensor activity. When automation from homeassistant is sent to force “off state”, no logs can be seen in zigbe2mqtt.
Besides, the author said that this code worked with conbee and was not hardware related…
I can trigger motion again after 6 seconds. I used rest_command like it was in github code. I was wondering about the state, because after 6 seconds the motion is not “clear” but is “offline” (direct translate). But works like a charm.
ok, can you share that rest command again, video is offline, i created below, allthough dont remember anymore exactlu
i tried below, but get invalid authentication error
rest_command:
wc_onder_off:
url: https://localhost:8123/api/states/binary_sensor.xiaomi_sensor_1
method: POST
headers:
authorization: !secret bearer
content-type: 'application/json'
payload: '{"state":"off"}'
verify_ssl: false
2020-02-19 19:16:56 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 127.0.0.1
2020-02-19 19:16:56 WARNING (MainThread) [homeassistant.components.rest_command] Error. Url: https://localhost:8123/api/states/binary_sensor.xiaomi_sensor_1. Status code 401.
2020-02-19 19:16:58 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback async_track_state_change.<locals>.state_change_listener(<Event state_...ew_state=None>) at /usr/src/homeassistant/homeassistant/helpers/event.py:81
Traceback (most recent call last):
File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 103, in state_change_listener
event.data.get("new_state"),
File "/usr/src/homeassistant/homeassistant/core.py", line 364, in async_run_job
target(*args)
File "/usr/src/homeassistant/homeassistant/components/automation/state.py", line 92, in state_automation_listener
call_action()
File "/usr/src/homeassistant/homeassistant/components/automation/state.py", line 78, in call_action
context=to_s.context,
AttributeError: 'NoneType' object has no attribute 'context'
No. You need to have an automation to send off state after X seconds. After that you can do another automation to turn on lights.
See the automation of an example:
- id: '1582110183955'
alias: Teste
trigger:
- platform: state
entity_id: binary_sensor.movimento
to: 'on'
condition: []
action:
- delay: '00:00:06'
- service: rest_command.testesensor
After that I would do 2 automations, one to turn on light after sensor ON, and another to turn off light when sensor OFF for x seconds
yes, thats what i do
in my first automation, when motion is detected , so state from off to on, then i turn on the light, and i turn off the binary sensor to off after 6 sec
my second automation i turn my light off, when motion sensor goes to off, but with a delay of 60 secs offcourse … otherwise my light would go already off after 6 seconds
so in my opinion thats a good automation? it should work like that normally