APsystems APS ECU R local inverters data pull

How you did it then, reagrding power consumption? First I was thinking about to extend power box to use power usage DIN components and measure with s0 channels. But I dont have any space anymore. Want to have more insights of power usage and solar production (more realtime). So was think about CT clamps also. But the Aeotec also need to have one pair link, instead of full cable, right? So you need to open the cable or mess 12v cabling with high voltage inside the power box, which is also not preferable. I also have three phase car-charger which like to monitor. So sharing any info is welcome :wink:

Anyone here upgrade to HA of August? I get the integration failures and sensors don’t come up.
Something with constant VOLT. Error. Will get right log with error

I haven’t yet, but was planning on doing it this weekend - the added energy dashboard is very interesting. A quick look shows they renamed some of the constants:

I think if you change line 30 and 68 in sensor.py from VOLT to ELECTRIC_POTENTIAL_VOLT it should work.

Let me know if that fixes it for you.

1 Like

will give it a try… will be quick

btw… the issue in this topic from ahof, revolves around the ECU not responding and requiring to close the connection after each query. Is this something we can include in the code?

async def async_query_ecu(self):
self.reader, self.writer = await asyncio.open_connection(self.ipaddr, self.port)
_LOGGER.info(f"Connected to {self.ipaddr} {self.port}")

cmd = self.ecu_query
self.ecu_raw_data = await self.async_send_read_from_socket(cmd)

self.process_ecu_data()

self.writer.close()
self.reader, self.writer = await asyncio.open_connection(self.ipaddr, self.port)
_LOGGER.info(f"Connected to {self.ipaddr} {self.port}")

cmd = self.inverter_query_prefix + self.ecu_id + self.inverter_query_suffix
self.inverter_raw_data = await self.async_send_read_from_socket(cmd)


self.writer.close()
self.reader, self.writer = await asyncio.open_connection(self.ipaddr, self.port)
_LOGGER.info(f"Connected to {self.ipaddr} {self.port}")

cmd = self.inverter_signal_prefix + self.ecu_id + self.inverter_signal_suffix
self.inverter_raw_signal = await self.async_send_read_from_socket(cmd)

self.writer.close()

data = self.process_inverter_data()
data["ecu_id"] = self.ecu_id
data["today_energy"] = self.today_energy
data["lifetime_energy"] = self.lifetime_energy
data["current_power"] = self.current_power

return(data)

def query_ecu(self):

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.ipaddr,self.port))

sock.sendall(self.ecu_query.encode('utf-8'))
self.ecu_raw_data = sock.recv(self.recv_size)

self.process_ecu_data()

sock.shutdown(socket.SHUT_RDWR)
sock.close()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.ipaddr,self.port))

cmd = self.inverter_query_prefix + self.ecu_id + self.inverter_query_suffix
sock.sendall(cmd.encode('utf-8'))
self.inverter_raw_data = sock.recv(self.recv_size)

sock.shutdown(socket.SHUT_RDWR)
sock.close()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((self.ipaddr,self.port))

cmd = self.inverter_signal_prefix + self.ecu_id + self.inverter_signal_suffix
sock.sendall(cmd.encode('utf-8'))
self.inverter_raw_signal = sock.recv(self.recv_size)

sock.shutdown(socket.SHUT_RDWR)
sock.close()

data = self.process_inverter_data()

data["ecu_id"] = self.ecu_id
data["today_energy"] = self.today_energy
data["lifetime_energy"] = self.lifetime_energy
data["current_power"] = self.current_power


return(data)

100% correct, you deserve a :+1:

Great, it works with the new unit constant. Only thing now is to add the data source for ECU’s energy production to the list to enable the “add solar production”. It’s not in the list and the cause revers to https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics
image
There is no parameter from the ECU-R integration that is listed here above.

We could include that but it’s really strange that I haven’t had this problem at all, and been querying it non-stop for months now. Is there something different about this setup?

Which sensor needs the state_class addition? is that sensor.ecu_lifetime_energy? or should it be the daily production one?

Looking at it a little more I think it should be daily production, but also needs a last_reset indicator - which should be pretty easy to do. Once I upgrade to August release, I can get these changes pushed into the repo after I had a chance to do a little testing.

It should be a kWh parameter, so it might need a calculation from current energy production in Watts somehow. But it’s all a bit hasty analysis, the addition in HA looks great.

That would be great! Remember to add the calVer correction to correct version display from HACS.

kinda lol… i did a template months back for daily solar energy to combine with P1 datas

utility_meter:
  daily_solar_energy:
    source: sensor.ecu_today_energy
    cycle: daily

that one is available and to select in energy config and does a reset over day switch. So we can see if this is the right way to go tomorrow and see if that addition is good for the integration

1 Like

his ECU has other kind of firmware, atleast version greater then ours somehow
“Version”: “ECU_R_PRO_2.0.0”. With the disconnect port it started working

I tried to add the template but I must do something wrong. How do you implement this on HA? (and by the way does it work!). I’m curious to see it working!

yeah… template is the wrong word, sorry. Its the utility meter integration, where you can addthis as item. Just copy paste as main node in config yaml.

currently it looks like this, will do some value validations later as the power consumed from grid is netto instead of absolute

some time later

Nice! I managed to add the script now, let’s see how it works out in the next view hours. Thnx!

Kevin, how did you make the pop card with Voltage details per inverter? Can you share? Is done with card-mod?

Kevin, I found out that the ECU with 2.0 software doesnt work well with a open connection and multiple queries. When I closed them and reopen them for each query, it worked.
Other issue: my HA crashed because the ECU was also in a wrong state. After restart it worked again. Before restarting the ECU it reported after a query for hundreds like below (increment for each UID)

“UID17413”: {
“UID”: “’”,
“Online”: false,
“Type”: “Unknown”
},
“UID17414”: {
“UID”: “’”,
“Online”: false,
“Type”: “Unknown”
},
“UID17415”: {
“UID”: “’”,
“Online”: false,
“Type”: “Unknown”
},
“UID17416”: {
“UID”: “’”,
“Online”: false,
“Type”: “Unknown”
},
“UID17417”: {
“UID”: “’”,
“Online”: false,
“Type”: “Unknown”
},
“UID17418”: {
“UID”: “’”,
“Online”: false,
“Type”: “Unknown”
}
Can we make the integration more robust when ECU respons is not what HA integration suspect?

Even with two solarpanels things are starting to show now (after two hours), this is looking great. You can also add the Forecast.Solar integration. It will plot the forecast on the solar production graph.
image