Updating status of Virtual selector from device status

For heating/cooling related questions in Domoticz

Moderator: leecollings

Post Reply
ciberyan
Posts: 3
Joined: Saturday 01 December 2018 9:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Paris, FRANCE
Contact:

Updating status of Virtual selector from device status

Post by ciberyan »

Hello

Hope to be in the right place as it related to heating but also to Domo itself and Zwave
To be short
I have a Qubino Zwave device to drive my electric heater (ZMNHJD1)
This one act as a dimmer so I have a block script to easily set the level with button instaed of value > this works well
But if I change directly on the device, I am out of sync with my selector
On this example I set the device to 45% and so I should be on CONFORT-1 on the selector
Unfortunately it seems to be a one way street, from selector to device but no in the other way
Image
Is there any mean to refresh the status of a virtual selector with the status of a real device
Thanks in advance for your idea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Updating status of Virtual selector from device status

Post by waaren »

ciberyan wrote: Friday 12 April 2019 8:36 I have a Qubino Zwave device to drive my electric heater (ZMNHJD1)
This one act as a dimmer so I have a block script to easily set the level with button instaed of value > this works well
But if I change directly on the device, I am out of sync with my selector
On this example I set the device to 45% and so I should be on CONFORT-1 on the selector
Unfortunately it seems to be a one way street, from selector to device but no in the other way
Is there any mean to refresh the status of a virtual selector with the status of a real device
See below dzvents script; it should work both ways.

When not yet familiar with dzVents please start with reading Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."

Code: Select all

local dimmerDevice   = 'dimmer'
local selectorDevice = 'select'

return {	
			on =    {
						devices = {dimmerDevice, selectorDevice},
					},
              
    execute = function(dz, item)

		local selector = dz.devices(selectorDevice)
        local dimmer = dz.devices(dimmerDevice)
        
        local maxLevel = ( #selector.levelNames - 1 ) * 10
        
        if item.name == 'dimmer' then
            if item.level  < 1 and item.state ~= "On" then 
                selector.switchSelector(0) 
            elseif item.level  > 99 and item.state ~= "Off"  then 
                selector.switchSelector(selector.maxLevel)
            else 
                selector.switchSelector(dz.utils.round(item.level / 1000 * maxLevel) * 10 ).silent()
            end   
        else  -- = select
            dimmer.dimTo(selector.level / maxLevel * 100 ).silent()
        end

    end
} 
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
ciberyan
Posts: 3
Joined: Saturday 01 December 2018 9:12
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Paris, FRANCE
Contact:

Re: Updating status of Virtual selector from device status

Post by ciberyan »

Thanks for you help and direction
Some reading and understanding goal for this weekend I guess :D
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest