lvanderree / com.synplyworks.thenmore

Homey Then functionality
GNU General Public License v3.0
0 stars 4 forks source link

Turns off the light. #3

Open edsallo opened 5 years ago

edsallo commented 5 years ago

If the motion constantly and did not stop while the timer is running, the light still turns off. That is, if the sensor did not go out of the so-called "motion alarm turned on", then the light will turn off.

lvanderree commented 5 years ago

I am afraid the timer app cannot fix this issue. Your motion detector probably doesn't send new motion events, so the flow does not get triggered again, so the timer does not get reset.

Maybe you can configure your motion sensor to (re)send events during motion, or maybe you can change your flows: turn on the light when motion detected, turn off light after motion sensor sends event that motion has stopped (if it sends out that event)

edsallo commented 5 years ago

Coolcam Motion and Fibaro Motion sensors behave the same. I think other Z-Wave sensors are also working. They send a report about the movement and fall asleep. And only after the end of the movement is sent a report about it. Your plugin should restart the timer until it receives a report about the end of the movement. After that, turn off after a specified time.

lvanderree commented 5 years ago

I understand what you say/want but unfortunately Homey does not work that way. The app provides an action card that (re)starts an timer to turn on and afterwards turn off a device.

It provides timers, and the possibility to read out of timers are running, and the option to cancel timers. It cannot listen to events of the the trigger (your motion sensor). That is the way Homey is setup. You should design that yourself in flows.

You can however configure your motion sensor to report about motion that is still going on (at least the Coolcams can do that, I use those myself)

edsallo commented 5 years ago

Thank! What parameters should I change? On the example of Coolcam. http://manuals-backend.z-wave.info/make.php?lang=en&sku=NAS-PD01ZE&cert=ZC10-16105298

lvanderree commented 5 years ago

What I did is set a very short time for the blind time param 2 (1s) and a short time for motion detection param 6 (5s). This isn't perfect, but the easiest to make it work fairly ok.

I am however thinking about a solution to make it work better, but that will require 2 flows: first to 'prepare' the timer (turning lights on, and remember previous state) on motion detected, the second to start the timer (which will restore the device to previous state when timer ends) on motion ended trigger

edsallo commented 5 years ago

3 flow - homey 2018-12-14 04-27-24 3 flow - homey 2018-12-14 04-26-37

lvanderree commented 5 years ago

Exactly,those two triggers. What you can do for now, that will probably result in the same effect is: replace the 'turn light on' with a start timer, configured with a very long timeout. And configure the second flow with the timer to reset the timeout, even when the new timeout is shorter. After that timeout it will restore the lights to the state before the motion detected if I made it correctly.

I don't think you need the test in the second flow. Unless you want to see if someone turned off the light manually. You can use a timer card to test if the timer is running for that as well

edsallo commented 5 years ago

In the first flow, after turning on the light, it is necessary to add switching off the timer, then it works perfectly. screenshot_14

lvanderree commented 5 years ago

That is another way of doing it yes. it looks like a pretty stable solution this way. Only a petty that you still need 2 flows, but I haven't thought about any other solution with flows to fix that. The only thing I can think of is pairing all motion detectors, and devices in a settings page, but I don't want to diverge too much from the Homey way of doing things.

Ps. For Homey 2 I've updated the app to cancel running timers when you manually turn off the device (pressing the light button for instance). With that updated you probably don't need the cancel-timer card anymore, or why do you need the cancel timer cards for?

If you like I can backport these changes for Homey 1.5 as well, but I don't want to release those to the appstore before it is being tested (and since I am running Homey 2, I cannot test it anymore). So if you are comfortable with pulling a release from git and sideload it yourself with athom-cli I can make a new 1.5 version if you like.

edsallo commented 5 years ago

If there was a report "Motion Off", then there was a movement and did not stop, the timer will turn off the light. For this in the first flow - "cancel timer" Yes, I can install through the CLI.

2.0 was too buggy and I returned to 1.5.