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

5.12.0l Sunrise and Sunset Times are Way Off #2461

Closed
dennyfmn opened this issue Apr 16, 2018 · 27 comments
Closed

5.12.0l Sunrise and Sunset Times are Way Off #2461

dennyfmn opened this issue Apr 16, 2018 · 27 comments
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended

Comments

@dennyfmn
Copy link

Hardware (2) Sonoff TH with Si7021 sensor, also Sonoff Basic with added DS18B20 sensor. All three units report the same erroneous sunrise and sunset times.

Result of Status 0, notice sunrise and sunset times:

stat/sonoff06/STATUS {"Status":{"Module":4,"FriendlyName":["Sonoff06"],"Topic":"sonoff06","ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":1}}
stat/sonoff06/STATUS1 {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://192.168.1.3:80/api/arduino/sonoff.ino.bin","RestartReason":"Software/System restart","Uptime":"1T01:05:50","StartupUTC":"2018-04-15T21:15:17","Sleep":0,"BootCount":12,"SaveCount":38,"SaveAddress":"FA000"}}
stat/sonoff06/STATUS2 {"StatusFWR":{"Version":"5.12.0l","BuildDateTime":"2018-04-15T16:08:37","Boot":31,"Core":"2_4_1","SDK":"2.2.1(cfd48f3)"}}
stat/sonoff06/STATUS3 {"StatusLOG":{"SerialLog":2,"WebLog":4,"SysLog":1,"LogHost":"192.168.1.29","LogPort":514,"SSId":["microwap2",""],"TelePeriod":60,"SetOption":["00008129","55818000"]}}
stat/sonoff06/STATUS4 {"StatusMEM":{"ProgramSize":494,"Free":508,"Heap":17,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3}}
stat/sonoff06/STATUS5 {"StatusNET":{"Hostname":"sonoff06-2920","IPAddress":"192.168.1.104","Gateway":"192.168.1.240","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.240","Mac":"2C:3A:E8:4F:4B:68","Webserver":2,"WifiConfig":3}}
stat/sonoff06/STATUS6 {"StatusMQT":{"MqttHost":"piserver","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_4F4B68","MqttUser":"DVES_USER","MqttType":2,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
stat/sonoff06/STATUS7 {"StatusTIM":{"UTC":"Mon Apr 16 22:21:07 2018","Local":"Mon Apr 16 17:21:07 2018","StartDST":"Sun Mar 11 02:00:00 2018","EndDST":"Sun Nov 04 02:00:00 2018","Timezone":99,"Sunrise":"17:38","Sunset":"31:10"}}
stat/sonoff06/STATUS10 {"StatusSNS":{"Time":"2018-04-16T17:21:07","SI7021":{"Temperature":75.4,"Humidity":41.8},"TempUnit":"F"}}
stat/sonoff06/STATUS11 {"StatusSTS":{"Time":"2018-04-16T17:21:07","Uptime":"1T01:05:50","Vcc":3.504,"POWER":"OFF","Wifi":{"AP":1,"SSId":"microwap2","RSSI":100,"APMac":"10:C3:7B:D1:FE:D0"}}}

Latitude and Longitude are set correctly:

stat/sonoff06/RESULT {"Latitude":"44.736330"}
stat/sonoff06/RESULT {"Longitude":"-93.308710"}

Thanks!

@localhost61
Copy link
Contributor

Yes indeed, your daytime is more than 24h in the USA, what a chance, you're able to do more work in a day ;-).

Try with the absolute value of the Longitude, it may solve the issue.

Even if this is not the source code origin, I've seen a warning in this git that a negative Longitude leads to odd results.
(In Tasmota's xdrv_09_timers.ino @arendst writes that he refers to Sonnen Auf- und Untergang mit dem Arduino berechnen )

@localhost61
Copy link
Contributor

localhost61 commented Apr 17, 2018

Yep, the code is not tuned.

Playing a bit with longitude and latitude commands in the Webserver console, it appears that negative numbers are not properly stored for both Longitude and Latitude, clearly a data typing error.
13:20:43 CMD: longitude -2.48
13:20:43 RSL: RESULT = {"Longitude":"-1.520000"}
13:24:02 CMD: latitude -8.00001
13:24:02 RSL: RESULT = {"Latitude":"-7.999990"}
13:24:24 CMD: latitude -1.48
13:24:24 RSL: RESULT = {"Latitude":"-0.520000"}
The mantisse sign is opposite of the integer:
-1.48 -> (-1)+(0.48) = -0.52
-93.308710 -> (-93)+(308710) = -93.691290
It's not the same error but it shows where to search ;-)

@arendst arendst added the bug Type - Confirmated Bug label Apr 17, 2018
@dennyfmn
Copy link
Author

dennyfmn commented Apr 17, 2018 via email

@arendst
Copy link
Owner

arendst commented Apr 17, 2018

@dennyfmn there might be more things wrong but for now the acceptance of your longitude/latitude inputs fail because I used a routine to keep code space small but it seems not to be minus friendly.

I'll have to fix that first before going on to a then possible location problem.

Stay tuned.

@dennyfmn
Copy link
Author

dennyfmn commented Apr 17, 2018 via email

arendst added a commit that referenced this issue Apr 17, 2018
5.12.0l
 * Fix negative Latitude and Longitude value entry (#2461)
@arendst
Copy link
Owner

arendst commented Apr 17, 2018

Fixed the negative value issue. Pls enter your values again and see if it finds the correct Sunrise/Sunset values.

@dennyfmn
Copy link
Author

dennyfmn commented Apr 17, 2018 via email

arendst added a commit that referenced this issue Apr 17, 2018
5.12.0l
 * Fix sunrise and sunset calculation (#2461)
@arendst
Copy link
Owner

arendst commented Apr 17, 2018

Fixed calculation sunrise and sunset for Minneapolis and the world ;-)

You can add as many defines as you like in the override file. Just give it a try.

@arendst arendst added the fixed Result - The work on the issue has ended label Apr 17, 2018
@dennyfmn
Copy link
Author

dennyfmn commented Apr 17, 2018 via email

@dennyfmn
Copy link
Author

dennyfmn commented Apr 17, 2018 via email

@localhost61
Copy link
Contributor

Perfectly working here too after firmware update. Same values as on sunrise-and-sunset.
2018-04-18
Sunrise: 07h10
Sunset: 21h00

sonoff_5 12 0l - configuration timer

It seems mandatory to specify days 1111111 otherwise it seems to do nothing. I'll see in a few hours.

@arendst arendst closed this as completed Apr 18, 2018
@gorgiea
Copy link

gorgiea commented Apr 18, 2018

Is it possible to display the current time and timezone on this page?.. makes it easier to detect issues. Maybe even have a web interface to set the time/timezone?

@gorgiea
Copy link

gorgiea commented Apr 18, 2018

Also the offset should be labeled.. some might get confused on what these boxes are for or which one is hh:mm.

image

@arendst
Copy link
Owner

arendst commented Apr 18, 2018

See 5.12.0m where it makes more semse I think.

@gorgiea
Copy link

gorgiea commented Apr 18, 2018

Ok 5.12.0m is better... but now it seems I set the sunset timer on the "Timer Config" page and when I go to check it in the console, I run the "timer 1" cmd which just shows me that the sunset time is "00:00", I run the "timer 1" cmd again, and it resets my timer to "Mode 0"... Is this expected? Should it reset the timer just from running the "timer 1" cmd? Also should the sunset time show something other than: "00:00", shouldn't it show "20:04" (my sunset time) in the console?

image

image

@localhost61
Copy link
Contributor

The command is "timer1" to retrieve Timer #1 data. Remove the blank.

@gorgiea
Copy link

gorgiea commented Apr 18, 2018

Ok, so just by having the space there, it was copying timer3 to timer1?...

Will the sunset and sunrise "Time" always show as "00:00" in the console?

image

@localhost61
Copy link
Contributor

localhost61 commented Apr 18, 2018

Yes, if Timer is an alias for Timer1, with the command : Timer 3 you made a copy of Timer3 in Timer1, if I refer to the Commands wiki

Currently I can't compile the latest release, so I can't tell you if there is a regression here.
But check Longitude, Latitude and insure Timezone 99

@gorgiea
Copy link

gorgiea commented Apr 18, 2018

Checked latitude and longitude, also set timezone to 99. Still shows "00:00" as the "Time" for sunset "timer1" .

We'll see if the sunset timer1 works here, shortly... (EDT, sunset = 20:04).

Thanks for your help!

image

@localhost61
Copy link
Contributor

Same behavior here (regression???).
I'll know more about it a couple of hours ;-)

@arendst
Copy link
Owner

arendst commented Apr 19, 2018

It's not showing sunset or sunrise time. It's the offset time what is shown equal to the webpage.

@localhost61
Copy link
Contributor

localhost61 commented Apr 19, 2018

@arendst I think that something is broken now in the timers behavior with v5.12.0m.
I'm playing with rules, timers and sunrise using webserver. And when testing standard "Time" timers it appears that the timer is properly stored but the hour field is reset when the Timer is edited again.
It's true whatever the selected action. In this screenshot, Time was set to 17:16...
sonoff_5 12 0m - configuration timer png

@arendst
Copy link
Owner

arendst commented Apr 19, 2018

You observe this only when going from "Temps" to "Lever.." and back. It's caused by the way the hour select option is changed from 24 hour to 11 hour to accomodate the + and - offset.

It's more a feature than a bug ;-) but I'll look into it anyway.

@localhost61
Copy link
Contributor

localhost61 commented Apr 19, 2018

Hi Theo,
Yes, I confirm that the field is not updated if previous screen shows Hour=00.

But here, it's the case because Timer1 and Timer2 are Suntime related and as I don't use other timers (out of Timer3 for testing the rules behavior) , they have default hour.

When I register Timer3 with a non null Time field, I'm directed to Configuration Menu, and when I come back on Timer Configure page for checking, it defaults on Timer1 that is setup with Sunset time and the hour field is effectively 00. Then I select Timer3 and as you stated the Hour field remains unchanged.

So here, I'm not going from "Temps" to "Lever.." , I'm switching from another Timer view.

I confirm that if I edit Timer1 in standard mode with Hour != 00, then when I register the changes and come back, Timer1 and 3 show the correct hour. I could put Timer 3 in pole position, but I prefer to keep timers 1&2 related to Output 1&2 for my Dual R2, it's easier to remember, and I have memorized that Button 1 is for Down at Sunset, Button 2 for Up at Sunrise.

arendst added a commit that referenced this issue Apr 20, 2018
Fix Web timer Hour reset (#2461)
@arendst
Copy link
Owner

arendst commented Apr 20, 2018

Should be solved now.

@localhost61
Copy link
Contributor

localhost61 commented Apr 20, 2018

Should be solved

Yes, I have build development commit (#64) and everything works as attended. Thanks.

curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.12.0l
 * Fix negative Latitude and Longitude value entry (arendst#2461)
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.12.0l
 * Fix sunrise and sunset calculation (arendst#2461)
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
@OfferLa
Copy link

OfferLa commented Aug 22, 2019

As a newbie to this great world of Tasmota,
I can confirm the in my place (with NPT active in my network), right after I updated the Latitude and Longitude of my place - Sunrise and Sunset timers worked like a charm.
Thank you so much for this great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type - Confirmated Bug fixed Result - The work on the issue has ended
Projects
None yet
Development

No branches or pull requests

5 participants