Busch-Jaeger / node-free-at-home

4 stars 5 forks source link

EnergyBatteryV2 not working #11

Closed sirrrich closed 3 months ago

sirrrich commented 6 months ago

Hello, I have the problem that it is not possible to set values ​​for an EnergyBatteryV2 device. The same applies to an EnergyInverterBatteryV2 device, as this only creates an EnergyBatteryV2 device internally. I discovered that there are no PairingIds available via the REST API and it is therefore not possible to set values. Everything works for all other energy devices. Is this a bug in Free@Home or is the EnergyBatteryV2 device not fully implemented? In energy management, an icon and various panels are displayed, but no values ​​can be set. I am in the process of implementing an implementation for the Zendure Solarflow system and would also like to integrate the battery.

StefanGuelland commented 4 months ago

If you create a device like this:

const freeAtHome = new FreeAtHome();
const channel = await freeAtHome.createEnergyInverterV2Device("123inverter");

You should get a device in free@home with this ouput datapoints:

 "outputs": {
              "odp0000": {
                "pairingID": 1190,
                "value": "0"
              },
              "odp0001": {
                "pairingID": 1191,
                "value": "0"
              },
              "odp0002": {
                "pairingID": 1221,
                "value": "0"
              },
              "odp0003": {
                "pairingID": 1222,
                "value": "100"
              },
              "odp0004": {
                "pairingID": 1224,
                "value": "0"
              }
            },

I have tested this with firmware 3.2.4. The energy management devices are under development and the interface should be considered as not stable at the moment.

sirrrich commented 4 months ago

Thank you for the feedback,

however, the problem occurs when setting up a inverter-battery device:

const freeAtHome = new FreeAtHome();
const channel = await freeAtHome.createEnergyInverterBatteryV2Device("123inverterbattery");

or battery device:

const freeAtHome = new FreeAtHome();
const channel = await freeAtHome.freeAtHome.createEnergyBatteryV2Device("123battery");

The output datapoints for the battery device is then empty:

"outputs": {
            },

I am also running version 3.2.4.

sirrrich commented 3 months ago

I was able to solve the problem myself after intensive research. To set values for an EnergyInverterBatteryV2Device or EnergyBatteryV2Device, it is necessary to specify additional capabilities:

setBatteryPower -> CAP_ENERGY_CURRENT_POWER setSoc -> CAP_STATE_OF_CHARGE setImportedEnergyToday/setExportedEnergyToday -> CAP_ENERGY_TODAY setTotalEnergyImported/setTotalEnergyExported -> CAP_ENERGY_TOTAL

Then the output datapoints are also correctly set:

"outputs": {
              "odp0000": {
                "pairingID": 1197,
                "value": "0.46"
              },
              "odp0001": {
                "pairingID": 1196,
                "value": "49"
              },
              "odp0002": {
                "pairingID": 1222,
                "value": "2000"
              },
              "odp0003": {
                "pairingID": 1223,
                "value": "0"
              },
              "odp0004": {
                "pairingID": 1224,
                "value": "0"
              },
              "odp0005": {
                "pairingID": 1225,
                "value": "0"
              }
            },
const freeAtHome = new FreeAtHome();
const channel = await freeAtHome.createEnergyInverterBatteryV2Device("123inverterbattery",
[Capabilities.CAP_STATE_OF_CHARGE,Capabilities.CAP_ENERGY_CURRENT_POWER,Capabilities.CAP_ENERGY_TOTAL,Capabilities.CAP_ENERGY_TODAY]);

This is also correctly displayed in the interface:

Beispielbild

The API or documentation could potentially be more transparent at this point.