Switching on PV Power

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
TeamKleijn
Posts: 15
Joined: Sunday 05 January 2020 13:03
Target OS: -
Domoticz version:
Contact:

Switching on PV Power

Post by TeamKleijn »

Hello all,

i've implemented the Domotics Energy view by using P1 data from my 'slimme meter'
Some virtual devives are added by the installation script for a 3phase environment i have the device "kWh Delivery L3 (Calculated)"
Ill gives the Power wich sended back at the grid when there is enough sun on the panels. The value = 0 or positive in watts

So i want to us the script below to switch ON a Tasmota device if Power > 1000 Watt and switch off when it come's below 500 watt

below my script :

Code: Select all

return {
    active = true,
    on = {	
    		devices = {"kWh Delivery L3 (Calculated)"}
        },
    execute = function(domoticz, device)
    
    if (domoticz.devices("Tas76-ZonneStroom").state == 'Off' and
        domoticz.devices("kWh Delivery L3 (Calculated)").Watt ~= nil and
    	domoticz.devices("kWh Delivery L3 (Calculated)").Watt > 1000 )
    then
    	domoticz.devices("Tas76-ZonneStroom").switchOn()
     end
  end
  }
The problem is "Tas76-ZonneStroom" don't switch on when there is enough sunpower.
Can somebody help me with this script ?

Thanks a lot

Rob
User avatar
waltervl
Posts: 5902
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Switching on PV Power

Post by waltervl »

For a kWh, general device there is no Watt attribute, there is a actualWatt attribute. See the wiki for the proper attributes per device
https://wiki.domoticz.com/DzVents:_next ... _scripting

The script probably should shown errors in the log as "domoticz.devices("kWh Delivery L3 (Calculated)").Watt" is not known. That error should have warned you already.

You asked AI to generate this script?
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 1 guest