-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Open
Labels
Description
The problem
Temperature reported as 0°C when the temperature(probably humidity as well) is unavailable from the API:
Temperature reading from official website:
Probably caused by the following using "0" as fallback:
def _convert_current(self, data: dict[str, Any]) -> dict[str, Any]:
"""Return temperature and humidity in the appropriate format."""
return {
API_HUMIDITY: data[API_HUMIDITY][API_DATA][0][API_VALUE],
API_TEMPERATURE: next(
(
item[API_VALUE]
for item in data[API_TEMPERATURE][API_DATA]
if item[API_PLACE] == self.location
),
0,
),
}
What version of Home Assistant Core has the issue?
core-2025.7.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Hong Kong Observatory
Link to integration documentation on our website
https://www.home-assistant.io/integrations/hko/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
API response at the time:
{"lightning":{"data":[{"place":"Lantau","occur":"true"},{"place":"New Territories East","occur":"true"},{"place":"New Territories West","occur":"true"},{"place":"Hong Kong and Kowloon","occur":"true"}],"startTime":"2025-08-05T05:45:00+08:00","endTime":"2025-08-05T06:45:00+08:00"},"rainfall":{"data":[{"unit":"mm","place":"Central & Western District","max":59,"min":42,"main":"FALSE"},{"unit":"mm","place":"Eastern District","max":42,"min":23,"main":"FALSE"},{"unit":"mm","place":"Kwai Tsing","max":68,"min":60,"main":"FALSE"},{"unit":"mm","place":"Islands District","max":84,"min":4,"main":"FALSE"},{"unit":"mm","place":"North District","max":42,"min":7,"main":"FALSE"},{"unit":"mm","place":"Sai Kung","max":63,"min":24,"main":"FALSE"},{"unit":"mm","place":"Sha Tin","max":62,"min":38,"main":"FALSE"},{"unit":"mm","place":"Southern District","max":43,"min":19,"main":"FALSE"},{"unit":"mm","place":"Tai Po","max":77,"min":48,"main":"FALSE"},{"unit":"mm","place":"Tsuen Wan","max":67,"min":34,"main":"FALSE"},{"unit":"mm","place":"Tuen Mun","max":31,"min":17,"main":"FALSE"},{"unit":"mm","place":"Wan Chai","max":52,"min":38,"main":"FALSE"},{"unit":"mm","place":"Yuen Long","max":53,"min":21,"main":"FALSE"},{"unit":"mm","place":"Yau Tsim Mong","max":49,"min":37,"main":"FALSE"},{"unit":"mm","place":"Sham Shui Po","max":73,"min":62,"main":"FALSE"},{"unit":"mm","place":"Kowloon City","max":52,"min":36,"main":"FALSE"},{"unit":"mm","place":"Wong Tai Sin","max":48,"min":44,"main":"FALSE"},{"unit":"mm","place":"Kwun Tong","max":43,"min":30,"main":"FALSE"}],"startTime":"2025-08-05T05:45:00+08:00","endTime":"2025-08-05T06:45:00+08:00"},"icon":[64],"iconUpdateTime":"2025-08-05T06:00:00+08:00","specialWxTips":["Violent gusts reaching 100 kilometres per hour or above may affect Hong Kong. Members of public should seek safe shelter immediately.","The local weather is adverse. Persistent rainstorm will cause serious road flooding and traffic congestion. Members of the public are advised to take shelter in a safe place. Heavy rain may bring flash floods, and flooding may also occur in watercourses. Members of the public should take note of the latest weather information from the Observatory, and listen to radio or watch television for traffic conditions.","Under the influence of an active southwest monsoon and upper-air disturbances, areas of intense thundery showers continue to develop over the vicinity of the Pearl River Estuary. According to the latest assessment, the Black Rainstorm Warning Signal will at least remain in force until 9 a.m.","There is severe rainstorm in North District, Tsuen Wan and Tai Po Districts. It may cause serious flooding. Members of the public should stay on high alert and take necessary precautions to reduce their exposure to risk posed by the heavy rain and flooding. Hourly rainfall is expected to exceed or has exceeded 100 millimetres in the above regions.\nHeavy rain may bring about flash floods. People should stay away from watercourses. Drivers should beware that there are likely to be serious road flooding and traffic congestion."],"uvindex":"","updateTime":"2025-08-05T07:02:00+08:00","temperature":{"data":[{"place":"King's Park","value":24,"unit":"C"},{"place":"Hong Kong Observatory","value":24,"unit":"C"},{"place":"Wong Chuk Hang","value":24,"unit":"C"},{"place":"Ta Kwu Ling","value":24,"unit":"C"},{"place":"Lau Fau Shan","value":24,"unit":"C"},{"place":"Tai Po","value":25,"unit":"C"},{"place":"Sha Tin","value":24,"unit":"C"},{"place":"Tuen Mun","value":24,"unit":"C"},{"place":"Tseung Kwan O","value":24,"unit":"C"},{"place":"Sai Kung","value":25,"unit":"C"},{"place":"Cheung Chau","value":24,"unit":"C"},{"place":"Chek Lap Kok","value":25,"unit":"C"},{"place":"Tsing Yi","value":24,"unit":"C"},{"place":"Shek Kong","value":24,"unit":"C"},{"place":"Tsuen Wan Ho Koon","value":24,"unit":"C"},{"place":"Tsuen Wan Shing Mun Valley","value":24,"unit":"C"},{"place":"Hong Kong Park","value":24,"unit":"C"},{"place":"Shau Kei Wan","value":24,"unit":"C"},{"place":"Happy Valley","value":25,"unit":"C"},{"place":"Wong Tai Sin","value":24,"unit":"C"},{"place":"Stanley","value":24,"unit":"C"},{"place":"Kwun Tong","value":24,"unit":"C"},{"place":"Sham Shui Po","value":24,"unit":"C"},{"place":"Kai Tak Runway Park","value":24,"unit":"C"},{"place":"Yuen Long Park","value":24,"unit":"C"},{"place":"Tai Mei Tuk","value":24,"unit":"C"}],"recordTime":"2025-08-05T07:00:00+08:00"},"warningMessage":["The Black Rainstorm Warning Signal has been issued.","The Thunderstorm Warning has been issued. It will remain effective until 9:00 a.m. today. Severe squally thunderstorms are expected to occur over Hong Kong.","The Landslip Warning has been issued.","The Special Announcement of Flooding in Northern New Territories has been issued."],"mintempFrom00To09":"","rainfallFrom00To12":"","rainfallLastMonth":"","rainfallJanuaryToLastMonth":"","tcmessage":"","humidity":{"recordTime":"2025-08-05T07:00:00+08:00","data":[{"unit":"percent","value":96,"place":"Hong Kong Observatory"}]}}