Python Plugin: Sessy battery

Python and python framework

Moderator: leecollings

Post Reply
JanJaap
Posts: 191
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Python Plugin: Sessy battery

Post 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?
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Sessy battery

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JanJaap
Posts: 191
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: Sessy battery

Post by JanJaap »

ok tnx, then I'll rework it
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
JanJaap
Posts: 191
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: Sessy battery

Post 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.....
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Sessy battery

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests