IngmarStein / mielesolar

Trigger Miele SmartStart with SolarEdge inverters
MIT License
9 stars 0 forks source link

Load balancing with batteries #27

Closed requiemmg closed 1 year ago

requiemmg commented 1 year ago

Hi, Until niw, I have a simple setup wirhout batteries. But these will be installed in rhe next days. So I wonder ifvtherevis a kind of power management and how thus affectsbthus plugin. If course Id want my Machines to start before batteries are being loaded...but is this already managalbe?

IngmarStein commented 1 year ago

At this point, you need a more elaborate power management solution which allows you to prioritize consumers. You might be able to configure this with https://www.home-assistant.io. I hear that http://solarmanager.ch is also planning support for Miele devices.

requiemmg commented 1 year ago

Well, actually not quite. While I'd like to have this in HomeAssistant, there is currently no plugin available which would actually allow to send the start signal.

My batteries were just installed and as I thought, they are automatically priorized. While this plugin currently monitors excess power, this would lead to the machines being started only when batteries are full and there is still enough surplus power.

BUT there is quite a simple workaround (ok, simple for people who can code better than me), as you would only need to check a second Modbus parameter: sensor.solaredge_battery1_power

So the start signal could be sent if either the sensor.solaredge_m1_ac_power (which should be the one you are checking now) or sensor.solaredge_battery1_power is above the set trigger.

This would be a huge relief for me, is there a chance you add it? I'd like to reopen this as a feature request.

(Of course, this option could be made optional like a flag -overrideCharging, then you could choose if you would prefer loading you batteries or running your machines first).

requiemmg commented 1 year ago

Addition:

If I understand your code correctly (I'm not at all into Go), this is where you read the corresponding parameter:

func (s *server) currentPowerExport() (float64, error) {
    inverterData, err := s.mb.ReadHoldingRegisters(inverterDataBaseAddress, 40)
    if err != nil {
        log.Printf("error reading inverter registers: %s", err.Error())
        return 0, err
    }

If so, I think all that is needed is the register Address of the corresponding battery charging value. Should be available from https://knowledge-center.solaredge.com/sites/kc/files/sunspec-implementation-technical-note.pdf I think?

IngmarStein commented 1 year ago

I see. So you're using SolarEdge batteries whose state is published along with the meter data on modbus? In that case, it should be possible. It's a bit more complicated than what you describe because the documentation you linked to is incomplete (see https://github.com/nmakel/solaredge_modbus/issues/18#issuecomment-748448500). sensor.solaredge_battery1_power is something from Home Assistant. Fortunately, https://github.com/nmakel/solaredge_modbus/blob/master/src/solaredge_modbus/__init__.py#L598 has the schema how to parse the battery block, but I don't have a battery available for testing (yet). So it would probably a back-and-forth with you for testing builds. Would that work for you?

requiemmg commented 1 year ago

Absolutely! Maybe the modbus multi extension for solaredge from WillCodeForCats might also be helpful, at least he is scraping data from there... ( https://github.com/WillCodeForCats/solaredge-modbus-multi )

And yes, I have the SolarEdge StorEdge Batteries attached (2 Batteries 4,6 kWh each, but they are seen as one Battery by the system).

If helpful, I could also grant you access to my modbus-proxy so you can see the values for yourself, but I'd need a contact address to send you the data then.

IngmarStein commented 1 year ago

I've had a first shot at parsing the battery data, please give it a try. I'm getting an error when trying to read from the registers storing the battery data in my batteryless installation, but maybe that's expected. At the moment, it should just show you the battery info and print the instantaneous battery power. I'm especially curious if the floating point format matches.

requiemmg commented 1 year ago

Wow, you are blazing fast, thank you! I am at work right now but see if I can find sone time today to test this!

requiemmg commented 1 year ago

Hi,

this is the output from the new version when I set one machine to SmartStart.


Jul 10 12:02:28 RaspberryPi mielesolar[11745]: 2023/07/10 12:02:28 HTTP/2.0 200 OK
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Access-Control-Allow-Credentials: true
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X>
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Access-Control-Allow-Origin: *
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Access-Control-Max-Age: 1728000
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Content-Type: application/json
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Date: Mon, 10 Jul 2023 10:02:28 GMT
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: Vary: Accept-Encoding
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: X-Environment: mcs-eu-prod-std
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: X-Environment: mcs-eu-prod-default
Jul 10 12:02:28 RaspberryPi mielesolar[11745]:
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_r>
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: 2023/07/10 12:02:28 Inverter AC Power: 1586.500000
Jul 10 12:02:28 RaspberryPi mielesolar[11745]: 2023/07/10 12:02:28 Meter AC Power: 22.000000

Current state: Solar production is 7,5 kW, 1,3 kW go into the household appliances, the battery has 50% and is charging with 5 kW. The "inverter AC power" is showing the Panels to house production (battery charge is substracted in this value). The Meter AC Power is currently an import of 22 Watts (it is circling around 0). So this does not seem to be the correct register yet....

requiemmg commented 1 year ago

grafik This is my dashboard from the SolarEdge Modbus Multi Integration in HA. The marked value would be the one I need. The Integration makes 3 virtual devices (Inverter, Battery, Meter); this is from the Battery section.

IngmarStein commented 1 year ago

What does mielesolar print right after starting?

The latest version emits the battery info along with inverter and meter:

2023/07/10 13:00:48 Meter Manufacturer: WattNode
2023/07/10 13:00:48 Meter Model: N/A
2023/07/10 13:00:48 Meter Serial: 0
2023/07/10 13:00:48 Meter Version: 0
2023/07/10 13:00:48 Meter Option: Export+Import
2023/07/10 13:00:48 Battery Manufacturer: 
2023/07/10 13:00:48 Battery Model: 
2023/07/10 13:00:48 Battery Serial: 
2023/07/10 13:00:48 Battery Version: 
requiemmg commented 1 year ago

Ah, didnt see this.


Jul 10 13:22:37 RaspberryPi systemd[1]: Started Mielesolar.
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 WARNING: configuration file is ignored in automatic >
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Inverter Model: SE8K-RWB48BFN4
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Inverter Serial: 7B0503F4
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Inverter Version:
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 0004.0017.0136
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Meter Manufacturer: SolarEdge
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Meter Model: SE-MTR-3Y-400V-A
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Meter Serial: 606848072
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Meter Version: 78
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Meter Option: Export+Import
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Battery Manufacturer: SolarEdge
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Battery Model:
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Battery Serial: attery 9.2kWh
Jul 10 13:22:37 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:37 Battery Version: SolarEdge Home B
Jul 10 13:22:42 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:42 starting refresh
Jul 10 13:22:42 RaspberryPi mielesolar[13347]: 2023/07/10 13:22:42 GET /v1/devices HTTP/1.1
IngmarStein commented 1 year ago

Thanks! I mixed up the number of Modbus registers (16) and the number of bytes (32) in the CommonBattery model. Should be fixed now.

requiemmg commented 1 year ago

Looking good so far:

Jul 10 16:10:18 RaspberryPi systemd[1]: Started Mielesolar.
Jul 10 16:10:18 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:18 WARNING: configuration file is ignored in automatic >
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Inverter Model: SE8K-RWB48BFN4
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Inverter Serial: 7B0503F4
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Inverter Version:
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 0004.0017.0136
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Meter Manufacturer: SolarEdge
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Meter Model: SE-MTR-3Y-400V-A
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Meter Option: Export+Import
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Meter Version: 78
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Meter Serial: 606848072
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Battery Manufacturer: SolarEdge
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Battery Model: SolarEdge Home Battery 9.2kWh
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Battery Version: 48V DCDC 3.1.16 BMS 1.1300.0
Jul 10 16:10:19 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:19 Battery Serial: 7B0503F4
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:24 starting refresh
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:24 GET /v1/devices HTTP/1.1
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Host: api.mcs3.miele.com
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Accept: application/json
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: User-Agent: go-miele
Jul 10 16:10:24 RaspberryPi mielesolar[16743]:
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: 2023/07/10 16:10:24 HTTP/2.0 200 OK
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Access-Control-Allow-Credentials: true
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X>
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Access-Control-Allow-Origin: *
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Access-Control-Max-Age: 1728000
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Content-Type: application/json
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Date: Mon, 10 Jul 2023 14:10:24 GMT
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: Vary: Accept-Encoding
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: X-Environment: mcs-eu-prod-std
Jul 10 16:10:24 RaspberryPi mielesolar[16743]: X-Environment: mcs-eu-prod-default
IngmarStein commented 1 year ago

Ok, cool - much better. Now if there's a waiting device, you should also see the power reading from the battery, next to the AC and DC data from inverter and meter. I'm curious about that output.

requiemmg commented 1 year ago

Not yet...


Jul 10 16:42:59 RaspberryPi mielesolar[17351]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: Vary: Accept-Encoding
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: X-Environment: mcs-eu-prod-std
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: X-Environment: mcs-eu-prod-default
Jul 10 16:42:59 RaspberryPi mielesolar[17351]:
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_raw":1,"value_localized":"Washing mac>
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: 2023/07/10 16:42:59 Inverter AC Power: 1505.500000
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: 2023/07/10 16:42:59 Meter AC Power: -10.000000
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: 2023/07/10 16:42:59 error reading battery data: modbus: exception '2' (illegal data address), function '131'
Jul 10 16:42:59 RaspberryPi mielesolar[17351]: 2023/07/10 16:42:59 attempting to reconnect```
IngmarStein commented 1 year ago

Ok, try again

requiemmg commented 1 year ago

Thanks for your ongoing effort!

Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 starting refresh
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 GET /v1/devices HTTP/1.1
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Host: api.mcs3.miele.com
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Accept: application/json
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: User-Agent: go-miele
Jul 10 22:12:27 RaspberryPi mielesolar[2089]:
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 HTTP/2.0 200 OK
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Access-Control-Allow-Credentials: true
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Access-Control-Allow-Origin: *
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Access-Control-Max-Age: 1728000
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Content-Type: application/json
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Date: Mon, 10 Jul 2023 20:12:27 GMT
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: Vary: Accept-Encoding
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: X-Environment: mcs-eu-prod-std
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: X-Environment: mcs-eu-prod-default
Jul 10 22:12:27 RaspberryPi mielesolar[2089]:
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_raw":1,"value_localized":"Washing machine"},"deviceName":"Waschmaschine links","protocolVersion":4,"deviceIdentLabel":{"fabNumber":"000150786902","fabIndex":"19","techType":"WCR870","matNumber":"10931230","swids":["5836","20457","20449","25260","20450","5013","25314","25205","25313","2519>
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 Inverter AC Power: 961.500000
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 Inverter DC Power: 976.200000
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 Meter AC Power: 10.000000
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 error reading battery data: modbus: exception '2' (illegal data address), function '131'
Jul 10 22:12:27 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:27 attempting to reconnect
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 starting refresh
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 GET /v1/devices HTTP/1.1
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Host: api.mcs3.miele.com
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Accept: application/json
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: User-Agent: go-miele
Jul 10 22:12:32 RaspberryPi mielesolar[2089]:
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 HTTP/2.0 200 OK
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Access-Control-Allow-Credentials: true
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Access-Control-Allow-Origin: *
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Access-Control-Max-Age: 1728000
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Content-Type: application/json
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Date: Mon, 10 Jul 2023 20:12:32 GMT
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: Vary: Accept-Encoding
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: X-Environment: mcs-eu-prod-std
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: X-Environment: mcs-eu-prod-default
Jul 10 22:12:32 RaspberryPi mielesolar[2089]:
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_raw":1,"value_localized":"Washing machine"},"deviceName":"Waschmaschine links","protocolVersion":4,"deviceIdentLabel":{"fabNumber":"000150786902","fabIndex":"19","techType":"WCR870","matNumber":"10931230","swids":["5836","20457","20449","25260","20450","5013","25314","25205","25313","2519>
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 Inverter AC Power: 950.300000
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 Inverter DC Power: 964.700000
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 Meter AC Power: 33.000000
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 error reading battery data: modbus: exception '2' (illegal data address), function '131'
Jul 10 22:12:32 RaspberryPi mielesolar[2089]: 2023/07/10 22:12:32 attempting to reconnect
requiemmg commented 1 year ago

Again, I can offer you access to my modbus values, if this is helpful.

requiemmg commented 1 year ago

Oh, seems I was too fast after you pushed your update and the newest version didnt get installed; just checked and tried again. Sorry for that.

Now: First:

Jul 10 23:03:00 RaspberryPi mielesolar[2953]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: Vary: Accept-Encoding
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: X-Environment: mcs-eu-prod-std
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: X-Environment: mcs-eu-prod-default
Jul 10 23:03:00 RaspberryPi mielesolar[2953]:
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_raw":1,"value_localized":"Washing machine"},"deviceName":"Waschmaschine links","protocolVersion":4,"deviceIdentLabel":{"fabNumber":"000150786902","fabIn>
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: 2023/07/10 23:03:00 Inverter AC Power: 894.800000
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: 2023/07/10 23:03:00 Inverter DC Power: 908.500000
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: 2023/07/10 23:03:00 Meter AC Power: 0.000000
Jul 10 23:03:00 RaspberryPi mielesolar[2953]: 2023/07/10 23:03:00 Battery Power: 508852698040014476972397620482801664.000000

Then:

Jul 10 23:04:00 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:00 Meter AC Power: -3.000000
Jul 10 23:04:00 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:00 Battery Power: 130264992624029072398026658219514920960.000000
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 starting refresh
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 GET /v1/devices HTTP/1.1
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Host: api.mcs3.miele.com
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Accept: application/json
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: User-Agent: go-miele
Jul 10 23:04:05 RaspberryPi mielesolar[2953]:
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 HTTP/2.0 200 OK
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Access-Control-Allow-Credentials: true
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Access-Control-Allow-Origin: *
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Access-Control-Max-Age: 1728000
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Content-Type: application/json
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Date: Mon, 10 Jul 2023 21:04:05 GMT
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: Vary: Accept-Encoding
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: X-Environment: mcs-eu-prod-std
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: X-Environment: mcs-eu-prod-default
Jul 10 23:04:05 RaspberryPi mielesolar[2953]:
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_raw":1,"value_localized":"Washing machine"},"deviceName":"Waschmaschine links","protocolVersion":4,"deviceIdentLabel":{"fabNumber":"000150786902","fabIn>
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 Inverter AC Power: 945.400000
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 Inverter DC Power: 959.800000
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 Meter AC Power: 0.000000
Jul 10 23:04:05 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:05 Battery Power: -0.000000
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 starting refresh
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 GET /v1/devices HTTP/1.1
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Host: api.mcs3.miele.com
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Accept: application/json
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: User-Agent: go-miele
Jul 10 23:04:10 RaspberryPi mielesolar[2953]:
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 HTTP/2.0 200 OK
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Access-Control-Allow-Credentials: true
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Access-Control-Allow-Headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Access-Control-Allow-Origin: *
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Access-Control-Max-Age: 1728000
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Content-Type: application/json
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Date: Mon, 10 Jul 2023 21:04:10 GMT
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Strict-Transport-Security: max-age=15724800; includeSubDomains
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: Vary: Accept-Encoding
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: X-Environment: mcs-eu-prod-std
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: X-Environment: mcs-eu-prod-default
Jul 10 23:04:10 RaspberryPi mielesolar[2953]:
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: {"000150786902":{"ident":{"type":{"key_localized":"Device type","value_raw":1,"value_localized":"Washing machine"},"deviceName":"Waschmaschine links","protocolVersion":4,"deviceIdentLabel":{"fabNumber":"000150786902","fabIn>
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 Inverter AC Power: 949.800000
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 Inverter DC Power: 964.300000
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 Meter AC Power: 12.000000
Jul 10 23:04:10 RaspberryPi mielesolar[2953]: 2023/07/10 23:04:10 Battery Power: -0.000000

A bit weird. Of course, I have no solar production right now. Battery is discharging at 950 Watts (my current house consumption, which is correctly in AC and DC Power, Meter with 12 Watts import is fine). So, the battery is discharging right now, I will check again tomorrow in the day when the battery is charging.

requiemmg commented 1 year ago

Oh, and it triggered my dishwasher now. I suppose because the battery drain exceeded the trigger value which would normally represent solar production in a setup wirhout batteries.

IngmarStein commented 1 year ago

Battery Power: 508852698040014476972397620482801664.000000 is what I suspected: the floating point format needs special care.

requiemmg commented 1 year ago

Ok, can I do something to provide more info?

IngmarStein commented 1 year ago

You could update again and report back the battery-related output at startup … and report any other behavior change you might observe because the last commit completely swapped out the modbus library.

requiemmg commented 1 year ago

Ok, great. Just updated. This is the output after startup

Jul 14 06:26:09 RaspberryPi systemd[1]: Started Mielesolar.
Jul 14 06:26:09 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:09 WARNING: configuration file is ignored in automatic m>
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Inverter Model: SE8K-RWB48BFN4
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Inverter Serial: 7B0503F4
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Inverter Version:
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 0004.0017.0136
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Meter Manufacturer: SolarEdge
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Meter Model: SE-RGMTR-1D-240C-A
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Meter Option: Export+Import
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Meter Version: 0
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Meter Serial: 0
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery Manufacturer: SolarEdge
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery Model: SolarEdge Home Battery 9.2kWh
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery Version: 48V DCDC 3.1.16 BMS 1.1300.0
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery Serial: 7B0503F4
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery rated energy: 460fc000 W
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery maximum charge continuous power: 5650 W
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery maximum discharge continuous power: 8192 W
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery maximum charge peak power: 5200 W
Jul 14 06:26:10 RaspberryPi mielesolar[9347]: 2023/07/14 06:26:10 Battery maximum discharge peak power: 8300 W
requiemmg commented 1 year ago

And this is the output for the waiting machine. Seems good to me (early morning, nearly no solar production yet and the battery has been drained in the night).

Jul 14 06:27:45 RaspberryPi mielesolar[9347]: {"000186363210":{"ident":{"type":{"key_localized":"Device type","value_ra>
Jul 14 06:27:45 RaspberryPi mielesolar[9347]: 2023/07/14 06:27:45 Inverter AC Power: 22.931000
Jul 14 06:27:45 RaspberryPi mielesolar[9347]: 2023/07/14 06:27:45 Inverter DC Power: 23.280000
Jul 14 06:27:45 RaspberryPi mielesolar[9347]: 2023/07/14 06:27:45 Meter AC Power: -946.000000
Jul 14 06:27:45 RaspberryPi mielesolar[9347]: 2023/07/14 06:27:45 Battery Power: 0.000000
Jul 14 06:27:50 RaspberryPi mielesolar[9347]: 2023/07/14 06:27:50 starting refresh
Jul 14 06:27:50 RaspberryPi mielesolar[9347]: 2023/07/14 06:27:50 GET /v1/devices HTTP/1.1
Jul 14 06:27:50 RaspberryPi mielesolar[9347]: Host: api.mcs3.miele.com
Jul 14 06:27:50 RaspberryPi mielesolar[9347]: Accept: application/json
Jul 14 06:27:50 RaspberryPi mielesolar[9347]: User-Agent: go-miele
IngmarStein commented 1 year ago

Great! Looks like we're getting somewhere :)

So far, I've only parsed the battery data, but did not implement and behavior changes. The latest commit now add the battery power to the value reported by the meter. That is, the battery power is considered production and if the overall balance is higher than the threshold, the start signal is emitted, effectively prioritizing the appliances over the battery.

requiemmg commented 1 year ago

It works! Battery is currently loading over the trigger value, started my washing machine perfectly now! I am on my mobile device right now and will provide a log tomorrow, copy/paste from ssh session on phone screen is a pain... Thanks man, you are awesome!

requiemmg commented 1 year ago

14 09:27:53 RaspberryPi mielesolar[11905]: Content-Type: application/json Jul 14 09:27:53 RaspberryPi mielesolar[11905]: Date: Fri, 14 Jul 2023 07:27:52 GMT Jul 14 09:27:53 RaspberryPi mielesolar[11905]: Strict-Transport-Security: max-age=1572480>Jul 14 09:27:53 RaspberryPi mielesolar[11905]: Vary: Accept-Encoding Jul 14 09:27:53 RaspberryPi mielesolar[11905]: X-Environment: mcs-eu-prod-std Jul 14 09:27:53 RaspberryPi mielesolar[11905]: X-Environment: mcs-eu-prod-default Jul 14 09:27:53 RaspberryPi mielesolar[11905]: Jul 14 09:27:53 RaspberryPi mielesolar[11905]: {"000186363210":{"ident":{"type":{"key_loc>Jul 14 09:27:53 RaspberryPi mielesolar[11905]: 2023/07/14 09:27:52 Inverter DC Power: 953>Jul 14 09:27:53 RaspberryPi mielesolar[11905]: 2023/07/14 09:27:52 Inverter AC Power: 938>Jul 14 09:27:53 RaspberryPi mielesolar[11905]: 2023/07/14 09:27:52 Meter AC Power: 1.0000>Jul 14 09:27:53 RaspberryPi mielesolar[11905]: 2023/07/14 09:27:52 Battery Power: 3481.00>Jul 14 09:27:53 RaspberryPi mielesolar[11905]: 2023/07/14 09:27:52 starting device Waschmaschine

Ok, got it anyway 😉

IngmarStein commented 1 year ago

Glad to hear that, and thanks for the logs for confirmation!

Also thanks for the sponsorship, appreciate it. As usual: feel free to submit more feature requests in the future. I will benefit from this one as well once I get the exact same battery as you in the fall :)

requiemmg commented 1 year ago

Hey, great thing. Improved my self sufficiency to over 80 percent in the last days, and this includes our 10kW heat pump. So look forward to your batteries. Thanks again fir all the work, Ill keep looking after this improvement. A possible improvent might beca switch to decide if you want machines to be started from battery (without actual sufficient solar production) or nit, but I'd not use it because it woukd drain the battery in the evening.