Patch: Add attribute setListValidate for 98_dummy

Begonnen von Nestor, 05 Juni 2019, 12:29:47

Vorheriges Thema - Nächstes Thema

Nestor

If this attribute is set, only accept the command argument if it matches any word in the setList attribute. This avoids any typos or nonsensical values (when used via Telnet).

Example:
define Presence dummy
attr Presence setList Home Leave Return
attr Presence setListValidate 1
attr Presence webCmd state
attr Presence widgetOverride state:select,Home,Leave,Return


set Presence foo
Invalid argument foo, choose one of Home Leave Return


I used Google Translate for the German help reference.
Apologies for any mistakes.

amenomade

Very interesting and could be very helpful.
Thanks

Could you please move this thread (when you are on the first post, you have a button "THEMA VERSCHIEBEN" for that) to the "Automatisierung" subforum? This is where the module "dummy" is maintained.

Thx in advance
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

rudolfkoenig

As far as I see, the patch prevents checking set with arguments (set dummy dim 10), the widget specifier in setList (attr dummy setList dim:slider,1,1,10) is not yet handled either.

You can get the the desired effect with "attr dummy useSetExtensions", which handles all the above issues.
But I have to admit, that it is not the most obvious solution :)

Nestor

It only works for the basic use case when you want to set the state (as described in the example above).
Does the attribute useSetExtensions also not add all the SetExtensions commands (toggle, blink,...) by default?

rudolfkoenig

ZitatDoes the attribute useSetExtensions also not add all the SetExtensions commands (toggle, blink,...) by default?
Only if setList contains on and off.