Thanks for the information, I find it very interesting.
I’ll try to see if it works.
It is summer time on the Northern Hemisphere, people do not realise sun state changes, as it is really out of their interest by having long hours of sun.
If you did it wrong then anybody else can do it wrong, and at the end it leads to frustration from people who are starting with home automation with SmartThings. (because they think that must be the easiest for their use, and then they realise that a simple sun state is not working…)
Do a search with the phrase sunrise sunset LUA
, some other code samples will come up. Might be even something built-in as well.
I have doubts how time of day can be passed from a device to a rule and processed there…
What could be done is a custom capability that emits a value at sunrise and another at sunset.
To make it usable with positive and negative offsets, something else would have to be added, perhaps two capabilities with +/- time refence to sunset and sunrise emitted every minute.
These are the calculations that the code does for my location.
I will check to see if they are correct
2022-05-25T11:48:47.320289521+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:48:56.454049192+00:00 PRINT Zigbee Thing Sun <<<< Sun Altitud >>>> 69.816489503901
2022-05-25T11:48:56.469599859+00:00 PRINT Zigbee Thing Sun <<<< Sun Azimuth >>>> 164.56738279508
2022-05-25T11:48:56.474988525+00:00 DEBUG Zigbee Thing Sun Lidl Plug device thread event handled
2022-05-25T11:49:17.329852535+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:49:47.339814883+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:49:56.441382221+00:00 PRINT Zigbee Thing Sun <<<< Sun Altitud >>>> 69.866013756437
2022-05-25T11:49:56.449669887+00:00 PRINT Zigbee Thing Sun <<<< Sun Azimuth >>>> 165.22889411018
2022-05-25T11:49:56.460164554+00:00 DEBUG Zigbee Thing Sun Lidl Plug device thread event handled
2022-05-25T11:50:17.339789897+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:50:47.349828912+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:50:56.445967249+00:00 PRINT Zigbee Thing Sun <<<< Sun Altitud >>>> 69.91341671413
2022-05-25T11:50:56.459850916+00:00 PRINT Zigbee Thing Sun <<<< Sun Azimuth >>>> 165.89324306897
2022-05-25T11:50:56.465539249+00:00 DEBUG Zigbee Thing Sun Lidl Plug device thread event handled
2022-05-25T11:51:17.349808593+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:51:47.360280607+00:00 DEBUG Zigbee Thing Sun driver device thread event handled
2022-05-25T11:51:56.521819494+00:00 PRINT Zigbee Thing Sun <<<< Sun Altitud >>>> 69.958683085198
2022-05-25T11:51:56.529642403+00:00 PRINT Zigbee Thing Sun <<<< Sun Azimuth >>>> 166.56032433335
It could be a custom capability as minutes to sunset or minutes to sunrise than a comparison could be added to a rule like, if less than 30 (minutes), turn on light.
After sunset/sunrise could be negative numbers and reset at midnight.
I am not depending on this, it could just dodge the time to time broken sunrise/sunset rules.
@GSzabados
I made a new thread so as not to break this one.
I haven’t visited this thread for months. If anyone is wondering, the problem (sunrise not updating daily in a cloud executing Rule) still seems to exist…
@nayelyz Is this issue in the queue? Sunrise and Sunset are static values when written into rules. They get the value for the times when the rules are posted, and then they never update.
For example
“actions”:[
{
“every”:{
“specific”:{
“reference”:“sunset”,
“offset”:{
“value”:{
“integer”:0
},
“unit”:“Minute”
}
},
This was posted when sunset was 5:07 (1707). Sunset is now 5:15 (1715) but the rule is still executing at 5:07.
Thank you.
It had better be, I’ve been waiting a long time now. @andresg was working the problem. I’ve not heard anything new for several months but at that point they had been able to reliably repeat the problem once they realised it was only affecting rules running in the cloud.