OpenWeatherMap API codes
- Войдите на сайт для отправки комментариев
Чт, 05/12/2019 - 01:55
Hello dear friends,
please help me with any tips or advice's in my project;
if I have on Arduino weather code to see on display parameters of humidity from openweathermap.org and that is ok with correct value on screen
humidity = root["main"]["humidity"]; pressure = root["main"]["pressure"]; But for sunrise and sunset on local city, value is always 0.00 I try it all variants, but nothing
sunrise = root["sun"]; sunset = root["set"]; sunrise = root["city"]["sun"]["rise"]; sunset = root["city"]["sun"]["set"]; sunrise = root["sun"]["rise"]; sunset = root["sun"]["set"];
as I can see, the path is not correct, please correct me in this
info here: https://openweathermap.org/current
info here: https://openweathermap.org/current
best regards,
alexander
[quote = negavoid]
[/ quote]
Negavoid, Thank you for your time and good advice, it's work very well, but i did it that before; this display the UTC time for sun event, and I need for local time.
on weathermap is instructions for that city.sun.set, where city is selected before by code in my case
here is instructions:
can be used this for local time sunrise and sunset?
If you wish to get local time from the UTC one, just add or subtract the corresponding amount of seconds. For example,
To get the local times from ow api:
Check also if there are real values set and exists in json/xml api reply, when you see zero values as parsing result.
it seems that
root[
"city"
][
"sun"
][
"rise"
] not give any info
better way to find how to convert Unix value provided by
unsigned long sunrise = root ["sys"] ["sunrise"];
that give
"sunrise": 1560343627, "sunset": 1560396563in normal time like 08.10.00AM for example, but maybe I give up..