Hello,
I have 2 Fibaro WallPlugs an one Popp Switsch (all z-wave) with wattmeters.
Now I want to see the combined consumtion of all devices together.
Wattmeter1: 13Watt; Wattmeter2: 30Watt; Wattmeter3: 23Watt --> "Wattmeter total": 66Watt
I need a (virtual) Counter to put all devices in one ("Wattmeter total") together.
How can i do this?
Greetings
rudiraz
Count all electrical meters
Moderators: leecollings, remb0
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Count all electrical meters
try a LUA script as a Time event...
try this:
did not test it... but it should works
try this:
Code: Select all
totwatt = 0
commandArray = {}
for devName, devStaus in pairs(otherdevices) do
if string.sub(devName,1,9) == 'Wattmeter' then
totwatt = totwatt + tonumber(otherdevices_svalues[devName])
end
end
if totwatt ~= 0 then
commandArray['Wattmetertotal'] = tostring(tonumber(otherdevices_svalues[Wattmetertotal]) + totwatt)
end
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 10
- Joined: Thursday 31 December 2015 16:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Contact:
Re: Count all electrical meters
Ok thanks, I have to try it when I am at home.
And this Counter Shows the actual power consumption of all devices called "Wattmeter"?
Can this script be edited to use IDX.?
Then i can choose which Powermeters or Wattmeters (some are called with other names) i want to be listed
And this Counter Shows the actual power consumption of all devices called "Wattmeter"?
Can this script be edited to use IDX.?
Then i can choose which Powermeters or Wattmeters (some are called with other names) i want to be listed
-
- Posts: 79
- Joined: Tuesday 02 December 2014 22:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Count all electrical meters
cool, i was looking for this one
but need some help getting it working,
I created an "All Watt" dummy device and have named all Watt meters like: "device | Power Meter" so i adapted your code a little bit..
to check naming from 11 characters from the end..
but don’t have an output yet.., hope you can help me

but need some help getting it working,
I created an "All Watt" dummy device and have named all Watt meters like: "device | Power Meter" so i adapted your code a little bit..
to check naming from 11 characters from the end..
but don’t have an output yet.., hope you can help me
Code: Select all
totwatt = 0
commandArray = {}
for devName, devStaus in pairs(otherdevices) do
if (devName:sub(-11) =='Power Meter') then
totwatt=totwatt + tonumber(otherdevices_svalues[devName])
end
end
if totwatt ~= 0 then
commandArray['All Watt']=tostring(tonumber(otherdevices_svalues['All Watt']) + totwatt)
end
return commandArray
-
- Posts: 10
- Joined: Thursday 31 December 2015 16:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Contact:
Re: Count all electrical meters
I copied the lua script, but don't get an update too
I made a virtual custom sensor, right?

I made a virtual custom sensor, right?
-
- Posts: 79
- Joined: Tuesday 02 December 2014 22:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Count all electrical meters
I'm not a programmer but starting to understand the language. I will play around and when i got it working I post my script. 

-
- Posts: 10
- Joined: Thursday 31 December 2015 16:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Contact:
Re: Count all electrical meters
I hope so 

Who is online
Users browsing this forum: No registered users and 1 guest