Closed ed-holland closed 4 years ago
Thanks for pointing out this issue. I guess you are right, I will have a look at it.
I added better logging for failed REST requests and exit the update function when there is no response. In addition the sensor entities now still get created even if the very first request fails.
Fix working fine. There is a Warning message now which is fine.
2020-01-30 09:45:05 WARNING (SyncWorker_1) [custom_components.local_luftdaten.sensor] REST request error: HTTPConnectionPool(host='10.250.2.168', port=80): Read timed out. (read timeout=10)
Thx
Hi,
The integration with my Luftdaten_Sensor is working fine (thx for that). When the data retrieval coincides with the dust collection/sending the response takes longer. It seems that then the response returned by Rest is None. It probably is best to ignore this measurement or retry in 10 seconds.
Is this the correct assumption?
Error:
2020-01-12 16:34:24 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.feinstaubsensor_humidity is taking over 10 seconds 2020-01-12 16:34:24 ERROR (SyncWorker_5) [custom_components.local_luftdaten.sensor] Error fetching data: <PreparedRequest [GET]> 2020-01-12 16:34:24 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.feinstaubsensor_humidity fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/local_luftdaten/sensor.py", line 117, in update parsed_json = json.loads(value) File "/usr/local/lib/python3.7/json/__init__.py", line 341, in loads raise TypeError(f'the JSON object must be str, bytes or bytearray, ' TypeError: the JSON object must be str, bytes or bytearray, not NoneType
Data:
{"software_version": "NRZ-2020-129", "age":"0", "sensordatavalues":[{"value_type":"SDS_P1","value":"10.83"},{"value_type":"SDS_P2","value":"5.00"},{"value_type":"temperature","value":"4.50"},{"value_type":"humidity","value":"83.10"},{"value_type":"samples","value":"4398224"},{"value_type":"min_micro","value":"32"},{"value_type":"max_micro","value":"20151"},{"value_type":"signal","value":"-58"}]}