Skip to content

Commit 2bba2aa

Browse files
authored
fixing example and lowercase the "Time" attribute (#8)
1 parent a6b23e1 commit 2bba2aa

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,23 @@ The results will be parsed, formatted in JSON and published via MQTT.
5252
"abbreviation": "GMT+1",
5353
"utc_offset_seconds": 3600
5454
},
55-
"tomorrow": {
56-
"date": "2026-01-01",
57-
"temperature_2m_min": -9.211000442504883,
58-
"temperature_2m_max": 2.439000129699707,
59-
"rain_sum": 0,
60-
"showers_sum": 0,
61-
"snowfall_sum": 0,
62-
"weather_code": 71,
63-
"wind_speed_10m_max": 17.771753311157227,
64-
"wind_direction_10m_dominant": 234.57273864746094,
65-
"wind_gusts_10m_max": 32.39999771118164,
66-
"sunrise": 0,
67-
"sunset": 0,
68-
"daylight_duration": 30052.92578125,
69-
"sunshine_duration": 23301.818359375,
70-
"weather_code_text": "Snow fall: Slight intensity"
55+
"current": {
56+
"time": "2025-12-31T13:45:00+01:00",
57+
"temperature_2m": 0.10000000149011612,
58+
"relative_humidity_2m": 66,
59+
"is_day": 1,
60+
"rain": 0,
61+
"showers": 0,
62+
"snowfall": 0,
63+
"weather_code": 1,
64+
"cloud_cover": 6,
65+
"surface_pressure": 974.9057006835938,
66+
"wind_speed_10m": 3.3190360069274902,
67+
"wind_direction_10m": 257.47119140625,
68+
"wind_gusts_10m": 8.640000343322754,
69+
"weather_code_text": "Mainly clear"
7170
},
72-
"message_timestamp": "2025-12-31T14:37:19.159381+01:00"
71+
"message_timestamp": "2025-12-31T13:55:18.454689+01:00"
7372
}
7473
```
7574

src/app/bin/weather2mqtt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from lib.weather_codes import translate_weather_code
3131
from retry_requests import retry # seeAlso: https://pypi.org/project/retry-requests/
3232

33-
__version__ = "1.0.0"
33+
__version__ = "1.0.1"
3434
__script_path__ = os.path.dirname(__file__)
3535
__config_path__ = os.path.join(os.path.dirname(__script_path__), "etc")
3636
__local_tz__ = pytz.timezone("UTC")
@@ -252,7 +252,7 @@ def parse_current_weather(data: any, fields: list = []) -> dict:
252252
log.debug("Parsing current weather data from Open-Meteo API response.")
253253
parsed_data = dict()
254254

255-
parsed_data["Time"] = datetime.datetime.fromtimestamp(data.Time(), tz=__local_tz__).isoformat()
255+
parsed_data["time"] = datetime.datetime.fromtimestamp(data.Time(), tz=__local_tz__).isoformat()
256256

257257
for i in range(0, len(fields)):
258258
parsed_data[fields[i]] = data.Variables(i).Value()

0 commit comments

Comments
 (0)