I found another code that directly calculates sunset and sunrise.
I had to modify it a bit, but it works as a driver module
I will continue creating the capabilities to see what happens.
It would be nice if this was implemented on a virtual device so you donβt have to use a real device to run it.
In this of creating virtual devices I have no experience
2022-05-25T15:08:21.306571599+00:00 PRINT Zigbee Thing Sun <<< Sunrise: 06:50:00 Sunset: 21:33:00 Day Duration: 14 Hrs 43.0 Min >>>
2022-05-25T15:08:21.313002932+00:00 PRINT Zigbee Thing Sun <<< Sunrise: 06:50:00 Sunset: 21:33:00 Day Duration: 14 Hrs 43.0 Min >>>
@GSzabados,
I have made this driver that locally calculates sunrise, sunset, day length, offset from the current time to sunrise and sunset, which allows automation with up to +/- 600 minutes of sunrise or sunset
The offset time is calculated every 1 minute
I have tried an automation and it works, now I have not been able to test with a negative offset since the latest version of the app does not let me enter negative values
UPDATE:
If anyone wants to try it, itβs on my shared channel.
driver:
βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β Name β Zigbee Sunrise and Sunset Mc β
β Version β 2022-05-25T20:20:17.093509387 β
βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ
You just have to:
install it on the hub
do a driver change on any zigbee device you are using with an edge driver
That device will not lose anything that it has configured
You can go back to your original driver without losing anything
You can use a plug or sensor that you are not using on something important
Is the copy/paste trick not working anymore? (Copy this - and paste it first then enter the number. Or copy -30 or whatever value you needβ¦)
Otherwise, I thought this bug has been fixed ages ago.
@orangebucket, will you give it a try? This might solve all your problem with the built in way, and will give a longer offset than the default 60 minutes.
Yes, this worked perfectly until today I updated the version of the android app
The ideal for this would be to implement the code in a virtual edge device.
I have never created one, maybe @TAustin could do it when he will is less involved with the cameras
@orangebucket, considering when was last time this negative value misery, it should be considered as well, that someone removed all the fixes what has been implemented in the app during the years and caused a bunch of regressions⦠(including your original problem)
The 60 minute offset is just the app bods making it up again, though I guess it might have been based on a real limitation before the Rules API took over. I have three trivial Routines, and that is three too many. Same with Scenes. Unless and until they can be managed outside the app they canβt be taken seriously.
My problem is that if the Rules API doesnβt work then there isnβt much fun left in SmartThings at all. Edge drivers have no appeal for me. Maybe if they were only used for LAN stuff Iβd get it, but I see one solution where two were needed, and nothing is going to make Lua attractive.
Iβve only just twigged that there is an update to the app. I believe the OED are planning to amend their entry for FFS to say βSee SmartThings appβ.
I have modified the driver so that it calculates the sunrise and sunset offsets correctly when the day changes in the userβs location, since the sunsrise and sunset calculation code is performed with UTC time.
I hope it works fine both in local time with positive and negative UTC offsets
I have removed the visibility of the offset sunrise and susnset events so that the app history is not shown every minute
Driver version
βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β Name β Zigbee Sunrise and Sunset Mc β
β Version β 2022-05-26T10:13:13.405145088 β
βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ
the calculation module that I found on the internet, does all the calculations with the table format of the UTC time that lua sends.
In calculation of the data for the new day does it at 0 hours UTC and the calculations of the difference of local time with sunrise and sunset would not be correct until they are 0 hours UTC.
I made some corrections for the calculation of the offsets with the local time and I must have done it wrong
I tried it for positive local hours, in my case +2.
For the negatives it seems that I made the corrections wrong.
βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β Name β Zigbee Sunrise and Sunset Mc β
β Version β 2022-06-09T11:21:37.349590437 β
βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ
I have simulated your Lat, Long and local time and it works fine.
It only remains to check if the calculation of the offsets works well when the local time is greater than 7:00 p.m. (0h UTC - your local offset time) and less than 0:00 a.m.
Only thing that i would suggest is to use absolute number in time, and if possible to change wording for negative numbers to say βfromβ, and for positive to say βtoβ
Time βto/fromβ Local Sunset
Time βto/fromβ Local Sunrise
In any case this would only be useful for times greater than 60 minutes before and after sunrise and sunset, when smart lighting disappears.
Sunset and sunrise are local in the app routines and if smartthings increase the time before and after to more than 60 minutes, it would no longer have any added value
New name and version of the driver Zigbee Sunrise and Sunset Mc (Zigbee Calendar Mc)
To give it some utility more than a calculation of susrise and sunset with offsets, I have added Calendar functions to this driver, since from time to time someone needs to use it to automate irrigation or other things, that they need to use IFTT for example:
Added Capabilities of Date one and two:
They allow to make automations for period between dates
In order to make equal, greater or lesser comparisons, the chosen format must be an integer number.
The format to build a representative and comparable number of a date will be YYYYMMDD, that is, for today 2022, June, 10 it would be: 20220610
I didnβt find another way to enter usable data formant of date,
Capability Hour of the day: In this way it can be combined with sunrise and sunset to perform periods of sunrise or sunset and a fixed hour or less or greater than one hour.
Capability Day of the month: In this way you can make automations for a specific day of each month
Capability of the Month of the year: in this way automations can be made for a specific month of the year
Capability for Year: In case you need to do automation for a specific year
Capability to select Odd or Even days of the month: Automations can be made only for select odd or even days of each month.
All this can be combined with standard time preconditions such as day of the week or hour interval
I have installed in a plug that has a bad relay and I use it only as a repeater.
Can be used on any zigbee device that has no use.
If a battery device is used, no matter if the battery is depleted or removed, it will remain online indefinitely as a virtual device. Only the physical device will be needed to be able to uninstall the driver from your hub.
βββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β Name β Zigbee Calendar Mc β
β Version β 2022-06-10T11:43:41.621583325 β
βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ
If anyone finds something wrong or could be improved, please let me know.
@Mariano_Colmenarejo is a valuable Community member and heβs been developing awesome custom functionality using all the tools provided to developers (eg. custom capabilities) which is their purpose.
There are a lot of different use cases, and we report the feature requests that you all share with us. This way, the team is able to analyze those needs and implement them if necessary.
If you consider thereβs a capability that could help everyone, we can create a request for it to be developed as a stock capability.