FHEM Forum

FHEM => English Corner => Thema gestartet von: mgmino am 19 Dezember 2023, 04:01:48

Titel: Assigning a value to a dummy device
Beitrag von: mgmino am 19 Dezember 2023, 04:01:48
Why doesn't the following work as expected?
define count dummy
set count 1
set count {Value("count") +1}

The following works as expected but is less clear.
{ fhem "set count " .(Value("count") +1)}

Is there a better way to implement a counter?
Titel: Aw: Assigning a value to a dummy device
Beitrag von: binford6000 am 19 Dezember 2023, 06:52:45
help set
has some examples for the set command like: {(perlExpression)} with the result of perlExpression. 
Please note the round brackets around the PERL-code:
set count {(Value("count") +1)}
Cheers,
Sebastian
Titel: Aw: Assigning a value to a dummy device
Beitrag von: mgmino am 19 Dezember 2023, 07:41:45
Thank you for the prompt reply -- it works great. I scanned the help three times before I saw the documentation -- need better glasses  8)