Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

light turns on for almost the whole period rather than just once for 30sec to 30 minutes. #25

Closed
quizzical86 opened this issue Dec 30, 2020 · 6 comments
Labels

Comments

@quizzical86
Copy link

I am trying to use presence faker to create an intricate vacation lighting scheme for a light, based also on sunset and sunrise.
I tried to simplify it trastically for the reporting of this issue.

I want two lights to be controlled separately and I want them both to turn on 0 or 1 time briefly (between 30 seconds and 30 minutes) between sunset and sunrise.
Here you can see an inject node that injects the windowbegin and windowend 2 seconds after deployment (in reality it would do this at 04:00 and set the sunset and sunrise time of that day).
4 seconds after deployment another inject node also send the value true to indicate that the presence faker should work (in reality it would check whether I'm on holiday or not).
The two presence faker nodes receive this information and start setting the times. As you can see the bottom one provides as result that it turns on from 09:05:55 untill 16:11:10. This is clearly in violation of the requirement that it should only turn on briefly.
image

I can test this multiple times by moving a random node one cm and then hitting deploy again. The result is usually that one of the two nodes will turn on for most of the period windowbegin->windowend andthe other node will be off for the whole period.
Occasionally both will be off for the whole period.
It never gives the result of turning on briefly once (while this should happen half of the time.

Here is the code:
[{"id":"e2d0482e.92c5f8","type":"presence-faker","z":"34843a6c.50d986","name":"Holiday Master bedroom overdag","onPayload":"turn_on overdag","onPayloadType":"str","onTopic":"light.licht_master_bedroom","offPayload":"turn_off overdag","offPayloadType":"str","offTopic":"light.licht_master_bedroom","windowBegin":"09:00","windowEnd":"17:00","minDurationHours":0,"minDurationMinutes":"0","minDurationSeconds":"30","minDuration":"30","maxDurationHours":"0","maxDurationMinutes":"30","maxDurationSeconds":0,"maxDuration":"1800","minCount":"0","maxCount":"1","startupBehavior":"onMsg","actionOnDisable":"none","firstBlockType":"off","lastBlockType":"off","isLoggingEnabled":true,"x":1280,"y":2880,"wires":[[]]},{"id":"53baa77c.809318","type":"presence-faker","z":"34843a6c.50d986","name":"Holiday Master bedroom overdag2","onPayload":"turn_on overdag2","onPayloadType":"str","onTopic":"light.licht_master_bedroom","offPayload":"turn_off overdag2","offPayloadType":"str","offTopic":"light.licht_master_bedroom","windowBegin":"09:00","windowEnd":"17:00","minDurationHours":0,"minDurationMinutes":0,"minDurationSeconds":"30","minDuration":"30","maxDurationHours":0,"maxDurationMinutes":"20","maxDurationSeconds":0,"maxDuration":"1200","minCount":"0","maxCount":1,"startupBehavior":"onMsg","actionOnDisable":"none","firstBlockType":"off","lastBlockType":"off","isLoggingEnabled":true,"x":1280,"y":2820,"wires":[[]]},{"id":"8986cfa7.cf1f9","type":"inject","z":"34843a6c.50d986","name":"manually inject windowbegin and windowend","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"{\"windowBegin\":\"08:50:10\",\"windowEnd\":\"16:42:40\"}","payloadType":"json","x":890,"y":2820,"wires":[["53baa77c.809318","e2d0482e.92c5f8"]]},{"id":"198d039b.a1ae6c","type":"inject","z":"34843a6c.50d986","name":"True","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"4","topic":"","payload":"true","payloadType":"bool","x":1010,"y":2880,"wires":[["53baa77c.809318","e2d0482e.92c5f8"]]}]

@csuermann
Copy link
Owner

Hi @quizzical86,

Thanks for reaching out!

This behaviour is indeed odd. My spontaneous guess is that it has to do with "0" as lower boundary for "ON times". If you change that to 1 the node behaves as it should. Of course then you lose the randomness of how many times the lights will be switched on, though.

I'll look into it.

Best
C.

I'll

@github-actions
Copy link

🎉 This issue has been resolved in version 1.8.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@quizzical86
Copy link
Author

Oh wauw, that was fast. Thank you @csuermann

I've created a sequence that simulates rather accurately how I use a light normally (which varies depending on the time of day which is why I'm calling your presence faker node many times for 1 single light.

afbeelding

I'll test this for some time and if I come across any other issues, I'll report back :-)

Thanks for having created this great node!

If you want to improve it further, my suggestions would be:
Native support for sunset, sunrise etc
Allow creating many time periods within one single node, each with their own # of on times and min/max duration. This would allow doing all what I'm doing in the above flow, in a single node, resulting in a single node per light I want to control.
All non-essential suggestions, as it's possible allready today as per my above sequence ;-)

@csuermann
Copy link
Owner

Sun-position support would indeed be nice. Unfortunately I currently don't have the bandwidth to implement it. However, you can relatively easily use my suncron node and combine it with the presence-faker node.

@quizzical86
Copy link
Author

I just wanted to say thanks again for the presence faker node.
The automation that I built (which relies heavily on your node) is showing exactly the type of behaviour of my lights that I want to see :)

@csuermann
Copy link
Owner

Thank you for your kind feedback! Hearing that my project is adding value is very rewarding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants