APsystems APS ECU R local inverters data pull

I might have an idea what the problem is, please refer to Integration broke Home Assistant 2021.8.0 · Issue #16 · ksheumaker/homeassistant-apsystems_ecur · GitHub

I responded to the github issue

Looks like with the help of @ksheumaker the problem has been solved. I will provide a pull request.

New challenge however: How to add the data to the new energy panel?

Like the suggestion made earlier adding an utility_meter entry to Home-Assistant and adding that sensor to solar seems to work fine.

utility_meter:
daily_solar_energy:
source: sensor.ecu_today_energy
name: 'Daily solar energy'
cycle: daily


I haven’t had time to test the new release and energy panel. Once I get my system upgraded I’ll add the appropriate modifications so it can be selected. In the interim it seems the energy meter idea is working for others.

Works like a charm, thanks!
Looking forward to the other modifications.
@ksheumaker I’ve provided a pull request as discussed.

Im still not able to start HA with apsystems_ecur integration. System is fully loaded after the first message:
2021-08-05 22:45:40 INFO (MainThread) [custom_components.apsystems_ecur.APSystemsECUR] Connected to 192.168.1.15 8899

It worked yesterday ones. I already updated the VOLT to ELECTRIC_POTENTIAL_VOLT.
No more logging showed. Any idea how to investigate this on Hass OS?

Bummer!

  1. What’s the output of the Tweakers script?
  2. Did you apply the changes as found in my pull request on the GitHub page? Specifically the async_query_ecu function? Add support for ECU_R_PRO and additional QS1 inverter types by adriaanh · Pull Request #18 · ksheumaker/homeassistant-apsystems_ecur · GitHub

i have a deviation in the total kwh from solar in the dashboard.
utilty value:


ECU day value
image
wonder where this originates, maybe because of restarts of HA yesterday, shouldnt be but i’ll keep an eye on todays results (and wont touch HA instance)

Output tweakers script is still working. Nothing wrong with that.
The inverters types installed are inline with the ones already in the list, but also updated with your 806 type already. Also updated the VOLT modification. Really wierd to check where in the integration it goes wrong and who is responsible for what. HA is only open a socket and closing again after sending a string and grap the resonse.

Did you change the functions as I indicated?

Yes I did. Still running ECU_R_PRO_2.0.0. Not updated yet.

Hm, weird. Would you be able to insert several debug logging messages within the code? That way I was able to check where it goes wrong. For example:

    async def async_send_read_from_socket(self, cmd):
        current_attempt = 0
        while current_attempt < self.cmd_attempts:
            current_attempt += 1
            _LOGGER.debug("Send read from socket attempt " + str(current_attempt))

            self.writer.write(cmd.encode('utf-8'))
            _LOGGER.debug("Writer encode to utf 8. Now drain")
            await self.writer.drain()

            try:
                _LOGGER.debug("Within try except block -> wait for read from socket")
                return await asyncio.wait_for(self.async_read_from_socket(), 
                    timeout=self.timeout)
            except Exception as err:
                _LOGGER.debug(f"Failed on asyncio.wait: {err}")
                pass

I can confirm that let’s bring this under attention at HA.

I now have the same issue again. It worked for some time ok, but now stopped working again:

2021-08-06 13:46:53 DEBUG (MainThread) [custom_components.apsystems_ecur] Finished fetching apsystems_ecur data in 0.886 seconds
2021-08-06 13:47:53 DEBUG (MainThread) [custom_components.apsystems_ecur] Querying ECU
2021-08-06 13:47:53 INFO (MainThread) [custom_components.apsystems_ecur.APSystemsECUR] Connected to 192.168.98.82 8899
2021-08-06 13:47:53 DEBUG (MainThread) [custom_components.apsystems_ecur.APSystemsECUR] Send read from socket attempt 1
2021-08-06 13:47:53 DEBUG (MainThread) [custom_components.apsystems_ecur.APSystemsECUR] Writer encode to utf 8. Now drain
2021-08-06 13:47:53 DEBUG (MainThread) [custom_components.apsystems_ecur.APSystemsECUR] Within try except block -> wait for read from socket

Well got an answer allready: “The displayed amount (on the Energy page) is only updated 1 time per hour whereas the actual amount is real time”
Does this match up with your interpretation @checking12 ? We’ll have to see at the end of the day I guess.

Latest version in github fixes some of the ECU_R_PRO issues, the VOLT to ELECTRIC_POTENTIAL_VOLT and adds the flags necessary to sensor.ecu_lifetime_energy to work in the new energy dashboard.

3 Likes

FYI just added support for scan_interval: [SECS] in the config as well. The default is 60 if you leave out that key, but for those that seem to have less stable ECUs playing with this value may help.

1 Like

not really, it from yesterday, so that value wont udpate any more. but today there is no deviation anymore. Now i’m thinking on the other numbers. I think there is not taken into account, that solar energy and feed to grid substracted, is consumption to house and hence the calculation ‘from grid’ is off.

image

so, 1.11 solar production. from that 0.38 has gone to grid. So house consumed 0.73. PLus the 1,44 from grid, makes 2.17 and not 2.55

I’ve tested this for some time now, however it does not really help. After some time, the ECU becomes unresponsive (for queries, it does function normally), a restart fixes the problem. Is there a possibility somewhere a ‘writer’ or ‘reader’ stream stays open and the maximum number of connections (or something like that) is reached?