Page 1 of 1

state and active attributes of EvoHome HR92 (relay part)

Posted: Monday 30 November 2020 15:36
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

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

Posted: Monday 30 November 2020 16:00
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



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

Posted: Tuesday 01 December 2020 12:33
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

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

Posted: Tuesday 01 December 2020 15:13
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)

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

Posted: Thursday 03 December 2020 12:26
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

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

Posted: Thursday 03 December 2020 13:06
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.