Thanks,
If the URL works then the code should work.
The code is really pretty simple:
It calls the URL with the params
Gets a response back like what you posted.
Then looks for the values for the keys within the body…data section and returns the values.
If you look at the SENSOR_TYPES variable, it tells the system what to return and what the units are.
I’m struggling with why this is not working because I am using your exact data in my test bed.
Needs some more debug lines which I have added to the bottom if you want to see.
Mon Jul 08 2019 12:27:31 GMT+1000 (Australian Eastern Standard Time) fronius: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 377, 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/fronius/sensor.py", line 141, in update self._state = round(self._data.latest_data[self._json_key]["Value"], 1) TypeError: 'NoneType' object is not subscriptable
Might be a silly question
but is it possible to write out the full url it is using to grab the data into a log just to confirm it ?, or manually put the full url in the code just to test ??
It already logs the URL if you dig through the logs.
The problem is that there is an odd response coming back from the inverter that the code in Home Assistant can’t handle.
It shows no error for receiving a response or even getting values from the result. If this was a problem you would see errors relating to “keys” in the response.
Instead it seems unable to handle the values of the response, which is where I am struggling.
I can fudge a response with the URL I posted earlier and the code handles it no problem.
But as soon as you get the same data from the inverter it gives this TypeError: ‘NoneType’ object is not subscriptable error which I can’t figure out how to fix.
Well this is strange, I had to rebuild my HA then updated to the latest sensor.py. Deleted HA db restarted and guess what
Sensor are there and no errors
Now will have to see if it updates with no issues
how often should it update ??
Just as above, had to restore HA to previous night due to it crashing Raspberry Pi issue.
Still showed errors.
Updated to the latest sensor.py. - which we did yesterday anyway
Deleted HomeAssisatnt Database. -
Restarted and there is was.
Only thing is, I not sure it is updating (depending how often it supposed to )
ie no change to readings from above as of yet
All the data appears to be data from yesterday ???
Deleted _pycache rebooted
Still not updating from old data, looked at the file in the cache folder and they show errors ??
sensor.cpython-37.pyc
‘utf-8’ codec can’t decode byte 0xd2 in position 9: invalid continuation byte init.cpython-37.pyc
‘utf-8’ codec can’t decode byte 0xc1 in position 9: invalid start byte
not sure if this means anything ??
Hi @safepay I just wanted to say thank you for this custom component. My Fronius inverter was installed today and the component works great. Now I just need to create a nice Lovelace UI to go with it
Hi buddy sounds like you got it working I would use InfluxDB with your card… @Kelvin_Sudlow just did an hardware rest too on my raspberry pi and have not got any errors too. Sun is down so can’t test