FHT-8v friendly interface

Begonnen von Rok, 09 Februar 2013, 12:14:57

Vorheriges Thema - Nächstes Thema

Rok

Hi, does anyone know how one could have a simple dropdown with for example values like 0%, 25%, 50%,75% and 100%, in FHEM UI, for setting the value of an FHT-8V valve. By default, one has to click on the valve name, change the command from pair to set, enter the value and click a button.
Surely there must be a shorter way and a better ui option?

Thanks!

UliM

Hi,
sure :)

My approach was to define a dummy and define the possible values as a dropdown. Upon change, update the actual device with the new value.

Looks somewhat like

#dummy
define choosevalue dummy
attr choosevalue setList state:0,25,50,75,100
attr choosevalue webCmd state

#notify to update the actual device whenever the dummy gets changed
define n_setvalue notify choosevalue {my $value = Value("@");; fhem('set <device> '.$value);; fhem("setstate @ &nbsp");;}


And in the webfrontend, display the dummy instead of the actual device, or aditionally.

Does this work for you?

Best, Uli
RPi4/Raspbian, CUL V3 (ca. 30 HomeMatic-devices), LAN (HarmonyHub, alexa etc.).  Fördermitglied des FHEM e.V.

Rok

Hi Uli, thanks a lot for the answer! So, my code now looks like:

define MyValve FHT8V 1934
attr MyValve room Bedroom

define choosevalue dummy
attr choosevalue setList state:0,25,50,75,100
attr choosevalue webCmd state

#notify to update the actual device whenever the dummy gets changed
define n_setvalue notify choosevalue {my $value = Value("@");; fhem('set MyValve '.$value);; fhem("setstate @  ");;}


But nothing happens. A few questions in my head:
1) As per http://www.fhemwiki.de/wiki/FHT_8v_direkt_ansprechen, is this required: set <name> valve <value;>
2) how does one prevent MyValve to appear listed and then leave only choosevalue?
3) how could i have the dropdown reflect the actual state of the MyValve instead of always displaying 0 (the first value)?

Thanks!
Rok

UliM

Zitat von: Rok schrieb am Sa, 09 Februar 2013 17:17But nothing happens. A few questions in my head:
1) As per http://www.fhemwiki.de/wiki/FHT_8v_direkt_ansprechen, is this required: set <name> valve <value;>
Possible - I don't have any FHT8v...  so just add the word valve:
define n_setvalue notify choosevalue {my $value = Value("@");; fhem('set MyValve valve'.$value);; fhem("setstate @  ");;}

Zitat von: Rok schrieb am Sa, 09 Februar 2013 17:172) how does one prevent MyValve to appear listed and then leave only choosevalue?
Just adapt the room-attributes accordingly, e.g. set
attr myValve room hidden
attr chooselvalue room myroom

Zitat von: Rok schrieb am Sa, 09 Februar 2013 17:173) how could i have the dropdown reflect the actual state of the MyValve instead of always displaying 0 (the first value)?
Just define another notify that would carry over the current valve value to the dummy:
define carryover notify myValve:valve.* set choosevalue %

Good luck :)
Uli
RPi4/Raspbian, CUL V3 (ca. 30 HomeMatic-devices), LAN (HarmonyHub, alexa etc.).  Fördermitglied des FHEM e.V.