gastush / ha-renac

Home assistant custom component to support Renac Solar Inverter
https://buymeacoffee.com/gastush
MIT License
3 stars 0 forks source link

No sensor data available #8

Open hops-1 opened 7 months ago

hops-1 commented 7 months ago

I have installed the custom_component and can also start it within HA. However, I do not get any sensor data in the GUI. If I look into the home-assistant.log file, I get KeyErrors similar to:

KeyError: 'Sfrequency'
2024-01-30 23:00:59.526 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.renac_t_frequency fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 898, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1218, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/renac/sensor.py", line 174, in update
    self._attr_native_value = self.updater.fetch(self.field)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/renac/sensor.py", line 46, in fetch
    return self.data[field]
           ~~~~~~~~~^^^^^^^
KeyError: 'Tfrequency'

I hope you can help me with it, as I really would like to make the data of my PV system available within my HA. I do have a three phase hybrid inverter (model N3-HV-10.0), just in case this makes a different to your setup.

datshi001 commented 7 months ago

hops-1 - I had this working very nicely until a couple of days ago. I now get the KeyErrors you describe. But I have also noticed (again for the last couple of days) that I cannot get my data properly from the web login page anymore unless I use the Asia or S.America data centre (mobile app still works fine). I suspect that the 2 issues are related so I was waiting to see if the data centre issue gets resolved before flagging it up with the dev. As an aside, I'd previously contacted Renac in China (andy.zhang@renacpower.com) and they've told me that their R&D may look at implementing something for HA although I'm not holding my breath for that! I hope this gets sorted because it's clearly a good integration.

hops-1 commented 7 months ago

Hi datshi001! Thanks for sharing that you run into the same issue. Is there a way to change to the other data centre you refer to?

datshi001 commented 7 months ago

hops-1 log-in page (https://sec.renacpower.cn/#/access/signin) there's an option on the top right of the screen. Curiously the dashboard page works for the europe data centre - clearly something not right with the Renac set-up just now.

gastush commented 7 months ago

Indeed, the underlying API does not return any data about the Inverter anymore. The iPhone APP still works fine. I'll check if I can do a quick change to the code to switch to a different data center (thanks for the hint @datshi001 ). I'll keep you posted

gastush commented 7 months ago

Give it a try to the version 0.0.6 and let me know if it works

datshi001 commented 7 months ago

version 0.0.6 working great for me :) thank you @gastush

hops-1 commented 7 months ago

Thanks @gastush for the really quick reply and updated version 0.0.6. However, I still get the same kind of errors after the update and a reboot of the system:

2024-01-31 22:31:08.694 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.renac_generated_power fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 898, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1218, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/renac/sensor.py", line 111, in update
    self._attr_native_value = self.updater.fetch(self.field)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/renac/sensor.py", line 48, in fetch
    return self.data[field]
           ~~~~~~~~~^^^^^^^
KeyError: 'acPower'

Do you have any ideas or additional infos I could provide?

gastush commented 7 months ago

What is your inverter model ? are you sure that you used the right serial number (you can see it in the Renac SEC app) ?

hops-1 commented 7 months ago

With regards to the Serial number - yes, I double checked and it is correctly.

I am using a three phase hybrid inverter (model N3-HV-10.0) from Renac. The web interface is the same, but possibly the values provided by the API are different than for your model. I am not sure how to check this.

Edit: I found a Renac API description in the internet. Not sure if this is a valid document though. Apparently, there are some differences when it comes to what they call a "Energy storage inverter" (section 2.2.6). 1693416026158-renac-sec-api-document-v2.0.7.pdf

gastush commented 7 months ago

Indeed, the data output looks quite different. Note that the output for the On-Grid inverter is a bit different from what I get directly from the API... I'll see what I can do to make it work for the Energy Storage Inverter. I guess that having the power of the battery makes sense in that case. I'll if I can make the creation of the sensors a bit more dynamic; so only the relevant ones are created. It may take a bit of time as I don't have a system that I can use to test, but I'll keep you posted

hops-1 commented 7 months ago

Thanks @gastush - I wasn't expecting this, but I could offer to perform some tests on my system of course. Apparently, there is no way to communicate directly via email anymore. However, you can reach out to me via the linkedin profile that I added to my profile just a minute ago.