Missing data - ZAMG platform or sensor

The new ZAMG component in version 0.40 displays an “unknown” state and temperature: null. Some attributes are also missing. Look at the picture for the output of ZAMG component:

My configuration, if I use the component:

- platform: zamg
  station_id: 11101
  name: Wetter

The same is happening for ZAMG sensor. It looks like:

My configuration for the ZAMG sensor:

- platform: zamg
  station_id: 11101
  monitored_conditions:
    - temperature
    - humidity
    - wind_speed
    - wind_bearing
    - sun_last_hour
    - precipitation
    - dew_point

It seems that the component ist getting its data from http://www.zamg.ac.at/ogd/. But, if I check the csv file, which is requested, the component or/and sensor may have a problem with special characters (e.g. º for degree) in the header row. All attributes with a special character in the header are missing.

"Station";"Name";"Höhe m";"Datum";"Zeit";"T °C";"TP °C";"RF %";"WR °";"WG km/h";"WSR °";"WSG km/h";"N l/m²";"LDred hPa";"LDstat hPa";"SO %"
11010;"Linz/Hörsching";298;"13-03-2017";"11:00";6,1;-1,3;60;130;11,2;;20,5;;1026,9;988,5;83
11012;"Kremsmünster";383;"13-03-2017";"11:00";5,1;-0,9;66;60;11,9;67;27,7;0;1026,8;979,1;100
11022;"Retz";320;"13-03-2017";"11:00";7,1;-1;57;65;14;54;33,1;0;1026;987;99
[ ... ]

Could that be or am I doing something wrong?

Update: In the meantime, I have reported an issue (https://github.com/home-assistant/home-assistant/issues/6573).

No you did nothing wrong. Somebody was overly eager and removed a line of code that had a purpose and didn’t test his change. Here’s the patch if you want to have it working right now, otherwise we’ll have to wait for the pull request to go through.

--- a/homeassistant/components/sensor/zamg.py
+++ b/homeassistant/components/sensor/zamg.py
@@ -157,6 +157,7 @@ class ZamgData(object):
             response = requests.get(
                 cls.API_URL, headers=cls.API_HEADERS, timeout=15)
             response.raise_for_status()
+            response.encoding = 'UTF8'
             return csv.DictReader(response.text.splitlines(),
                                   delimiter=';', quotechar='"')
         except Exception:  # pylint:disable=broad-except
1 Like

Thank you very much. This works.