state and active attributes of EvoHome HR92 (relay part)

Moderator: leecollings

Post Reply
Bertvdw
Posts: 19
Joined: Sunday 08 October 2017 23:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

state and active attributes of EvoHome HR92 (relay part)

Post by Bertvdw »

For one of my scripts i need to know if the valve of the HR92 is (partly) opened.
By checking the state attribute (On/Off) or the active attribute (true/false) i should get this information.

I found that the state value is always Off and active is always false.

The reason for this is that in the file device-adapters/evohome_device.lua the _state attribute is checked for the relay subtype. Depending on the value of this attribute the state and active attributes are set.

I think the check is wrong , because _state is never On.
The actuals values are: settingLevel: 14% or Off

elseif device.deviceSubType == "Relay" then
if device._state == "On" then
device.state = "On"
device.active = true
else
device.state = "Off"
device.active = false
end


By changing the if statement in if device._state == "Off" it will work correct.

I hope somebody can change this for furture releases.

Gr. Bert
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: state and active attributes of EvoHome HR92 (relay part)

Post by waaren »

Bertvdw wrote: Monday 30 November 2020 15:36 By changing the if statement in if device._state == "Off" it will work correct.
I hope somebody can change this for furture releases.
Thx for reporting
Do you mean this?

Code: Select all

		elseif device.deviceSubType == "Relay" then

			if device._state == "Off" then
				device.state = "Off"
				device.active = false
			else
				device.state = device._state or "On"
				device.active = true
			end


Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Bertvdw
Posts: 19
Joined: Sunday 08 October 2017 23:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: state and active attributes of EvoHome HR92 (relay part)

Post by Bertvdw »

Thx for reacting Waaren.

I'm not comletely sure how to interpreted device.state = device._state or "On".
But if, as result of this the state attribute is On whenever the value of _state != Off, then it is what i suggested

Gr. Bert
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: state and active attributes of EvoHome HR92 (relay part)

Post by waaren »

Bertvdw wrote: Tuesday 01 December 2020 12:33 I'm not completely sure how to interpreted device.state = device._state or "On".
But if, as result of this the state attribute is On whenever the value of _state != Off, then it is what i suggested
Not completely.
If _state == "Off" it will set state to "Off"
if _state != "Off" it first try to set state to the value of _state and if _state does not exists ( == nil) then it will set state to "On"

Would it be possible for you to test this? (I tested the logic but do not own an HR92)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Bertvdw
Posts: 19
Joined: Sunday 08 October 2017 23:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: state and active attributes of EvoHome HR92 (relay part)

Post by Bertvdw »

Hi Waaren,

i did test your solution and it works like you discibe it.
For me it would be more usefull if the value is always "Off" if _state != "On" ( so just have 2 possible values On/Off to check in my script), the same as the dimmers example which is discribed in the manual:

state: String. For switches, holds the state like ‘On’ or ‘Off’. For dimmers that are on, it is also ‘On’ but there is a level attribute holding the dimming level. For selector switches (Dummy switch) the state holds the name of the currently selected level.

Because now the value of state is "Set level: 14%" when the valve is partly opened. In this case i would like to see:

state = "On" and level = 14

Gr. Bert
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: state and active attributes of EvoHome HR92 (relay part)

Post by waaren »

Bertvdw wrote: Thursday 03 December 2020 12:26 i did test your solution and it works like you describe.
There is also the attribute "active" you can use for that check.
device.active is false when the device.state == 'Off' and true otherwise.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest