freakent / node-red-contrib-sunevents

A node for node-red that generates events based on the position of the Sun at the appropriate time of day.
Apache License 2.0
15 stars 13 forks source link

Geographic location format #9

Closed SzymonZy closed 4 years ago

SzymonZy commented 4 years ago

Hello I want to track why I get completely wrong event times. I took location from here: https://dateandtime.info/pl/citycoordinates.php?id=3100946 and put Longitude: 19.12 and Latitude: 50.79 These are correct. Time zone and time on machine is setup correctly but I got lights turn on at Sunset 10:16 AM ?! Did I put data in wrong format? Regular inject at defined time works correctly.

freakent commented 4 years ago

Can you share your log file?

Regards, Martin

On 5 Mar 2020, at 19:20, Szymon Życiński notifications@github.com wrote:

 Hello I want to track why I get completely wrong event times. I took location from here: https://dateandtime.info/pl/citycoordinates.php?id=3100946 and put Longitude: 19.12 and Latitude: 50.79 These are correct. Time zone and time on machine is setup correctly but I got lights turn on at Sunset 10:16 AM ?! Did I put data in wrong format?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

SzymonZy commented 4 years ago

If I look at log time is calculated correctly but events are injected at wrong time.

Here is example: 4 Mar 22:08:44 - [info] [sun events:fa57e5a3.aeff68] Injecting event sunset for Thu Mar 05 2020 17:32:33 GMT+0100 (czas środkowoeuropejski standardowy)

At 22:08:44 node emitted sunset calculated to be at 17:32:33. This does not even look for timezone offset.

Would be there any conflict? obraz

obraz

Used this node in the past on hassio without any issues. Now I have on premise standalone installation on only this node makes troubles.

SzymonZy commented 4 years ago

Here is flow: [{"id":"67b81c90.32fd94","type":"tab","label":"Lampy Ganek","disabled":false,"info":""},{"id":"fa57e5a3.aeff68","type":"sun events","z":"67b81c90.32fd94","testmode":false,"verbose":true,"topic":"","name":"","x":140,"y":220,"wires":[["6064b731.30cea8","dbfccac0.5b03b"]]},{"id":"6064b731.30cea8","type":"switch","z":"67b81c90.32fd94","name":"zdarzenie","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"sunriseEnd","vt":"str"},{"t":"eq","v":"sunset","vt":"str"},{"t":"eq","v":"night","vt":"str"},{"t":"eq","v":"nightEnd","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":310,"y":220,"wires":[["d64cc329.077a88"],["808c0702.a33698"],[],[]]},{"id":"600be14d.fcf87","type":"api-call-service","z":"67b81c90.32fd94","name":"Włącz lampki schody","server":"c2e7ecb7.937f1","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.sonoffmini1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":720,"y":260,"wires":[[]]},{"id":"d64cc329.077a88","type":"api-call-service","z":"67b81c90.32fd94","name":"Wyłącz lampki schody","server":"c2e7ecb7.937f1","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.sonoffmini1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":180,"wires":[[]]},{"id":"cdd7aa3d.a75258","type":"inject","z":"67b81c90.32fd94","name":"wyłącz lampy o 23","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 23 *","once":false,"onceDelay":0.1,"x":190,"y":320,"wires":[["c4f56a18.87935"]]},{"id":"c4f56a18.87935","type":"api-call-service","z":"67b81c90.32fd94","name":"Wyłącz lampki schody","server":"c2e7ecb7.937f1","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.sonoffmini1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":600,"y":320,"wires":[[]]},{"id":"808c0702.a33698","type":"delay","z":"67b81c90.32fd94","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":510,"y":260,"wires":[["600be14d.fcf87"]]},{"id":"dbfccac0.5b03b","type":"debug","z":"67b81c90.32fd94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":340,"y":140,"wires":[]},{"id":"c2e7ecb7.937f1","type":"server","z":"","name":"localhost","legacy":false,"hassio":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]

SzymonZy commented 4 years ago

Can you tell me why after service restart sun events is not generating all Todays events and gives me only events from next day? Take a look at night generation. I should appear in about 55 minutes but is generates only next day event.

8 Mar 18:32:28 - [info] Starting flows 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] Calculating sun event times for 50.79, 19.12. 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Initialising job to calculate sunevents 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Calculating times for Sun Mar 08 2020 23:59:59 GMT+0100 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting solarNoon Tomorrow at 11:55 AM in 17 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting nadir Today at 11:55 PM in 5 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting sunrise Tomorrow at 6:11 AM in 11 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting sunset Tomorrow at 5:39 PM in 23 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting sunriseEnd Tomorrow at 6:14 AM in 11 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting sunset Start Tomorrow at 5:35 PM in 23 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting dawn Tomorrow at 5:38 AM in 11 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting dusk Tomorrow at 6:12 PM in 23 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting nauticalDawn Tomorrow at 5:00 AM in 10 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting nauticalDusk Tomorrow at 6:50 PM in 24 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting nightEnd Tomorrow at 4:21 AM in 9 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting night Tomorrow at 7:28 PM in 24 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting goldenHourEnd Tomorrow at 6:55 AM in 12 hours 8 Mar 18:32:30 - [info] [sun events:fa57e5a3.aeff68] [sunevents] Emitting goldenHour Tomorrow at 4:55 PM in 22 hours 8 Mar 18:32:30 - [info] Started flows 8 Mar 18:32:30 - [info] Server now running at http://127.0.0.1:1880/ 8 Mar 18:32:30 - [info] [mqtt-broker:localhost] Connected to broker: mqtt://localhost:1883 8 Mar 18:32:50 - [info] [server:localhost] WebSocket Connected to http://localhost:8123

freakent commented 4 years ago

@SzymonZy, my apologies, it looks like my replies via email didn't get loaded here. It looks like you are not running the latest version. I improved the logging and made a few tweaks to areas that timezones could be an issue. Are you able to upgrade to V2.0.3 ?

freakent commented 4 years ago

I am confused. The log file extract you have shared shows the events in a relatively random order. In the latest version v2.0.3 they are sorted into chronological order. But in another screen shot I can see you have version 2.0.3. Were these taken at different times?

In the version you have been running the calculations were being performed relative to midnight on the day you first run. In 2.0.3 I changed that to be mid day. After the initial run the script runs everyday at just after mid night.

freakent commented 3 years ago

Hi, I have a new Beta version of this SunEvents node that I think addresses this issue. Want to test it?

freakent commented 3 years ago

To try the V3 Beta follow the link to this issue:

21 V3 Beta Testers

Thanks!