Sum from voltage devices  [Solved]

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

Moderator: leecollings

Post Reply
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Sum from voltage devices

Post by Knibor »

Hi,

I tried the sum from 2 voltage devices in dzVents but no succes, could someone help me with this?

Cell Voltage 1 = device 136 virtual device General, voltage
Cell Voltage 2 = device 137 virtual device General, voltage
Sum of voltage device 136 and 137 = device 213. virtual device General, voltage

Code: Select all

return {

	on = {
	    timer = { 'every 1 minutes' }
	},
	
	execute = function(domoticz, item)
	    
	    local Cell1 = domoticz.devices(136)      
	    local Cell2 = domoticz.devices(137)     
	    local totalCells = domoticz.devices(213)  
	    
	    totalCells.updateVoltage(Cell1.Voltage + Cell2.Voltage)
	    
	end
	
}
Last edited by Knibor on Sunday 10 November 2019 10:47, edited 2 times in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Sum from voltage devices

Post by waaren »

Knibor wrote: Saturday 09 November 2019 21:01 Hi,

I tried the sum from 2 voltage devices in dzVents but no succes, could someone help me with this?

Code: Select all

   totalCells.updateVoltage(Cell1.Voltage + Cell2.Voltage)
The attributes of devices always start lowercase. So here it is

Code: Select all

   totalCells.updateVoltage(Cell1.voltage + Cell2.voltage) 
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Sum from voltage devices  [Solved]

Post by Knibor »

Hi,

Thanks for the info, now it works!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest