Page 1 of 1

Python Plugin: Sessy battery

Posted: Saturday 23 November 2024 20:49
by JanJaap
Hey all,

I'm creating a new plugin for the (Dutch) Sessy batteries. It's working quite ok so far, check my github if you want.

I have some questions for adding it to the energy dashboard:
I'm creating the following power related units:

Code: Select all

        if deviceId not in Devices or (self.batEnergyDeliveredUnit not in Devices[deviceId].Units):
            Domoticz.Unit(Name=deviceId + " - Battery delivered power", Unit=self.batEnergyDeliveredUnit, Type=243, Subtype=29, Switchtype=4, Used=1, DeviceID=deviceId).Create()
        if deviceId not in Devices or (self.batEnergyStoredUnit not in Devices[deviceId].Units):
            Domoticz.Unit(Name=deviceId + " - Battery stored power", Unit=self.batEnergyStoredUnit, Type=243, Subtype=29, DeviceID=deviceId).Create()
        if deviceId not in Devices or (self.batPowerUnit not in Devices[deviceId].Units):
            Domoticz.Unit(Name=deviceId + ' - Battery in/output power', Unit=self.batPowerUnit, Type=250, Subtype=1, DeviceID=deviceId).Create()
As I understood that the type 243 can only take energy flow in one direction (so in or out of battery). But when I want to configure the energy dashboard, only the type 243's are selectable. How do I set this up best in the plugin? Can I enter negative values into the 243?

Re: Python Plugin: Sessy battery

Posted: Saturday 23 November 2024 21:21
by waltervl
243 is Electricity (instant and counter)? Then it can take positive and negative values. I use it to monitor my normal grid usage as I do not have a P1 smart meter. And I have solar panels, so negative values (negative usage in Watt and rolling back counter Wh) are possible

Re: Python Plugin: Sessy battery

Posted: Saturday 23 November 2024 23:07
by JanJaap
ok tnx, then I'll rework it

Re: Python Plugin: Sessy battery

Posted: Sunday 24 November 2024 15:58
by JanJaap
@walter Somehow it does not seem to work. I created the device as follows:

Code: Select all

        if deviceId not in Devices or (self.batEnergyUnit not in Devices[deviceId].Units):
            # set switchtype to 4/exporting as positive is going out of battery (so producing)
            Domoticz.Unit(Name=deviceId + ' - Battery energy', Unit=self.batEnergyUnit, Type=243, Subtype=29, Switchtype=4, Options={'EnergyMeterMode': '1' }, Used=1, DeviceID=deviceId).Create()

When I feed it a negative power value, no update is recorded... In fact when feeding positive as well...... I'm giving '1' for energy as that should be ignored?

<update> When removing the calculated mode and instead feeding counter value, it works.....

Re: Python Plugin: Sessy battery

Posted: Sunday 24 November 2024 17:40
by waltervl
The zigbee4domoicz plugin is able to send negative watt values. The calculation mode for energy has an issue when plugin is used, see PR https://github.com/domoticz/domoticz/pull/6183