Is there any way to let raspberry itself find its own timezone after it gets connected to WiFi, but without help of longitude and latitude because it doesn't have any GPS.
Asked
Active
Viewed 145 times
2 Answers
0
You would need to first find some way to get a location for the device.
- If you have GPS, obviously use that.
- If you have Wi-Fi, then you might consider leveraging a Wi-Fi Positioning System database or API. Several are listed here, including both commercial and free options.
- If you only have wired Internet connection, you might consider using an IP Geolocation database, though understand there are many accuracy tradeoffs in doing so.
Once you have the location, you can refer to the list of options under How to get a time zone from a location using latitude and longitude coordinates?
If you don't have location at all, and you can't find a way to infer it, then sorry - you're out of luck. You'd have to gather the time zone through some other mechanism, such as through a user interface or manually set configuration file.

Matt Johnson-Pint
- 230,703
- 74
- 448
- 575
-
my original answer to this question that I can solve it with geocoder has been deleted by moderator. i don't know is there any taboo about sharing Youtube link or anything. – user10417959 Mar 15 '20 at 23:11
-
Your answer consisted of a single link to a YouTube video. Link-only answers are highly discouraged here, as there's no guarantee that the external resource will be available in the future (ie, it could be deleted). Instead, if you can provide a detailed answer that can stand alone, you can also add a link to the YouTube video or other external resources to support your answer. My answer is an example of that - as even if all of those Wikipedia links are deleted, the "meat" of the answer is still intact. Feel free to add your own answer using the geocoder library. – Matt Johnson-Pint Mar 16 '20 at 18:05
-
thanks! Bascally it can be easily solved by python-geocoder. – user10417959 Mar 17 '20 at 20:33
0
Geocoder to get location and timezone once device connects to Wi-Fi
import geocoder
g = geocoder.ip('me')
timezone = g.geojson['features'][0]['properties']['raw']['timezone']

user10417959
- 3
- 3