APsystems APS ECU R local inverters data pull

@HAEdwin, ksheumaker, CodingWerf : Thank you for your great work.
I installed my solar panels yesterday and set up the ECU-B.
Your AddOn reads all the data from the ECU and the inverter
So it seems to be compatible.

That’s great news, thanks for the feedback! This is with WiFi connection I assume?
@Apollon77 you might give it a new try. Compare firmware versions if it still does not work.

Yes, connected via WiFi in my local network.
The two LAN-ports are disabled by the manufacturer.
For your information, I have the firmware ECU_B_1.2.17009.

2 Likes

Did you see the message: { states(‘sensor.ecu_current_power’) | int - states(‘sensor.power_consumption’) | int }} {% else %} {{ states(‘sensor.power_consumption’) | int + states(‘sensor.ecu_current_power’) | int }} {%endif%}’ but no default was specified. Currently ‘int’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1

This is probably a custom sensor in configuration.yaml? Replacing the “int” instances for “int(0)” will solve your issue. This will default values to zero but is not recommended when you use conditional statements which use zero to trigger. I made one myself using float(0).

For those who have allready updated to HA 2021.12.0. You’ll find the following logline for inverter sensors: … implements device_state_attributes. Please report it to the custom component author.

As from version HA 2021.12 device_state_attributes is deprecated and should be replaced by extra_state_attributes. I’ll add this to the issue list on GitHub and add it to my pull request @ksheumaker. To solve this manually edit and replace two instances of def device_state_attributes for def extra_state_attributes in sensor.py

1 Like

easy fix… thx… wasnt updated yet, Max took my attention today :slight_smile:

also in binary_sensor.py btw? i do have it there too

Hey Sander, yes good practice to replace every instance. I noticed you were looking for the source of this deprecated info, it’s here: homeassistant.helpers — Home Assistant 2021.12.1 documentation

yeah… thats big list too.
have some other custom components that were logging these remarks. Fixed them all by now.

Now let’s hope Kyle @ksheumaker will merge the pull request soon.
I would like to upgrade HA to 2021.12 because of some ZHA device quirks that are included, but I’m waiting a few more days.

the logs are warnings for deprecation, real effect wont be there until next month orso. So go ahead for your ZHA things i would say. (i have only one downside on hue api, but it’s minor)

Merged the latest pull request. Haven’t had a chance to update HA in a while, thanks for the code modifications.

3 Likes

Updated HA, and this integration through HACS. All warnings gone, thanks for all the work everyone!

Seems for me in Hassio the problem is not fixed. For binary_sensor.py it need to be device_state_attributes, otherwise the module will not load. The sensor.py is excepted. Anyone knows why?

Strangely enough AdGuard and ECU-R firmware ECU_R_1.2.19009 don’t get along it seems. Rebooting the ECU with AdGuard enabled prevents the ECU from connecting to WiFi. I didn’t analyse this behavior right away because it could well be an effect of wanting to implement secure DNS.

If an active AdGuard in combination with a necessary reset of the ECU leads to the ECU no longer functioning, this is something to take into account. Maybe someone can confirm this behavior?

Fix is to temporarily disable AdGuard until the ECU is up and running, then enabling AdGuard again.

Figured it out. At ECU startup it checks availablility of domains and starts with ecueu.apsema.com. I blocked this URL so that fails and prevents the ECU from connecting to the WiFi home network. Guess that’s new with this latest firmware.

1 Like

today first time i had to restart ecu and it could not get to internet again. Couldnt figure what went wrong, but also on adguard, but not blocking any aps domains afaik.
somehow it didnt query dns (no logs in adguard) when ecu was repowered… Not sure i want to try it again today, but really wonders me a lot now it works again (did turn adguard off for a while)

Today it has connection issues , had to restart a wifi access point and all seems fine now. Not sure if the new firmware has wifi client changes included, let’s see if it stays stable now

It sure is something to take into account for AdGuard users. Latest APSystems firmware (ECU_R_1.2.19009) was again OTA pushed to our devices without any release notes, I regret that.

I noticed that the installation instructions don’t mention anything about the options regarding starting and stopping the query so I was in the process of adding that. I myself do not use stopping and starting the query at sunset and sunrise. This does result in some error messages in the log around 03:00 in the morning, but after that the ECU just picks it up again without any problems. So the integration works well without. Should I add it to the instructions anyway? This is what I would like to add to the instructions:
Although you can query the ECU 24/7, it is good practice to stop the query after sunset (apsystems_ecur.stop_query) and only start the query again at sunrise (apsystems_ecur.start_query). You can do this by adding automations.

Reason for this are the maintenance tasks that take place on the ECU around 02.45 AM local time. During this period the ECU port is closed which results in error messages in the log if the integration tries to query for data. During maintenance, the ECU is checking whether all data to the EMA website has been updated, clearing cached data and the ECU is looking for software updates, updating the ECU firmware when applicable.

adding some info on it, wont harm. Better to prevent undocumented feature.
Today i restarted HA and integration did not load as ecu wasnt reachable again. There is definitely some instalbility in newer firmware regarding WIFI for me.

I’ve also stopt using the automation to disable queries between dusk and dawn (still have them, but not enabled anymore). My error messages in the log start are around 2.14, every night (Dutch timezone), but as you said the ECU picks up after that without issues.

Mentioning the possibility to stop querying in the docs is a good thing. It’s possible, someone might want to use it.

I’m running the new firmware (ECU_R_1.2.19009) for a while, but have no issues at all when restarting HA. I just did the core 2021.12.5 update this morning, both HA and this integration started without issues.

Occasionally (once every ‘x’ months) the ECU becomes unavailable, and I have an automation in place to powercycle the ECU when that happens. In the first half of 2021 that happened a lot, but with newer firmware version the ECU became more stable (IMHO).