Usage of Perl expression in attr wait

Begonnen von Nestor, 25 November 2019, 19:41:24

Vorheriges Thema - Nächstes Thema

Nestor

I want to change the wait time for a DOIF during the weekend.
The following seems not be working:
(($we ? 18 : 16) * HOURSECONDS)

What is valid syntax to use?

amenomade

I would try with:
{($we ? 18 : 16) * HOURSECONDS}
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Nestor

Makes sense. :-)
The example in the DOIF#wait command ref is kind of confusing, since no curly braces are used for Perl expressions.

attr my_doif wait 1:[mydummy:state]*3:rand(600)+100,Attr("mydevice","myattr","")

Maybe this could be clarified?

Nestor

Zitat von: amenomade am 25 November 2019, 20:06:10
{($we ? 18 : 16) * HOURSECONDS}

Update: this does not work.
I suppose the code needs to put in a function because Perl expressions are not accepted in attr wait if I understand command ref correctly.

amenomade

Zitat von: Nestor am 26 November 2019, 11:03:26
Update: this does not work.
I suppose the code needs to put in a function because Perl expressions are not accepted in attr wait if I understand command ref correctly.
I'm afraid you're right. That would have been my second proposition.
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Damian

(($we ? 18 : 16) * HOURSECONDS)

Syntax is ok, but $we is unknown at wait
Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF

Nestor


Damian

Programmierte FHEM-Module: DOIF-FHEM, DOIF-Perl, DOIF-uiTable, THRESHOLD, FHEM-Befehl: IF