Page 1 of 1
Split measured value
Posted: Friday 05 March 2021 17:32
by Knibor
Hello,
I have a device called "Electric (Instant+Counter)". I want to create a new device that only shows the counter value. Can someone give me an example of how to do this in dzVents?
Thank you very much
Re: Split measured value
Posted: Friday 05 March 2021 17:41
by waaren
Knibor wrote: Friday 05 March 2021 17:32
I want to create a new device that only shows the counter value. Can someone give me an example of how to do this in dzVents?
What kind of device should the target be? A text device or a counter or a custom sensor or something else?
Re: Split measured value
Posted: Saturday 06 March 2021 11:12
by Knibor
Hi,
I currently have a device of the type "General, kWh".
This device gives me two values. The first is the current solar energy and the second is the value of today's total solar energy in kWh. I would like a separate device that only displays the kWh generated by the solar panels today. The device I would like to use is of the Text device.
Re: Split measured value [Solved]
Posted: Saturday 06 March 2021 12:33
by waaren
Knibor wrote: Saturday 06 March 2021 11:12
I currently have a device of the type "General, kWh".
I would like a separate device that only displays the kWh generated by the solar panels today. The device I would like to use is of the Text device.
Could look like script below
Code: Select all
return
{
on =
{
devices =
{
2515, -- change to idx of your solar device
},
},
logging =
{
level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all is ok
marker = 'solar to text',
},
execute = function(dz, item)
local solar = dz.devices('solar energy today') -- change to name of your text device
local currentText = solar.text
local newtext = item.counterToday .. ' kWh'
if currentText ~= newtext then
solar.updateText(newtext)
end
end
}
Re: Split measured value
Posted: Tuesday 09 March 2021 19:10
by Knibor
Hi,
Thanks a lot for the script. It works now.