FHEM Forum

FHEM => Automatisierung => Thema gestartet von: Nestor am 05 Juni 2019, 12:29:47

Titel: Patch: Add attribute setListValidate for 98_dummy
Beitrag von: Nestor am 05 Juni 2019, 12:29:47
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.
Titel: Antw:Patch: Add attribute setListValidate for 98_dummy
Beitrag von: amenomade am 05 Juni 2019, 13:46:12
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
Titel: Antw:Patch: Add attribute setListValidate for 98_dummy
Beitrag von: rudolfkoenig am 08 Juni 2019, 12:41:08
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 :)
Titel: Antw:Patch: Add attribute setListValidate for 98_dummy
Beitrag von: Nestor am 08 Juni 2019, 14:20:30
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?
Titel: Antw:Patch: Add attribute setListValidate for 98_dummy
Beitrag von: rudolfkoenig am 08 Juni 2019, 17:14:45
ZitatDoes the attribute useSetExtensions also not add all the SetExtensions commands (toggle, blink,...) by default?
Only if setList contains on and off.