FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: flipse am 22 Februar 2019, 16:27:57

Titel: Frage zu notify
Beitrag von: flipse am 22 Februar 2019, 16:27:57
Hi,

was mache ich hier falsch?

ZWave_SW_Voute_Esszimmer.on
IF ([ZWave_SW_RGBW] eq "off")
(
set ZWave_SW_RGBW rgb ReadingsVal('ZWave_SW_RGBW','_lastRGBhex','FFFFFF')
)


Ich möchte, dass eine Variable des Readings zugeordnet wird.
Leider erhalte ich im Log immer:

2019.02.22 15:26:26 3 : set ZWave_SW_RGBW rgb ReadingsVal('ZWave_SW_RGBW' : set rgb: a 6-digit hex number is required
2019.02.22 15:26:26 3 : '_lastRGBhex' : Unknown command '_lastRGBhex', try help.
2019.02.22 15:26:26 3 : 'FFFFFF') : Unknown command 'FFFFFF'), try help.
2019.02.22 15:26:26 3 : SW_Voute_Esszimmer_n return value: Unknown command 'FFFFFF'), try help.

Auch mit richtigen Anführungszeichen oder wenn ich sie weglasse, oder readingsnum wähle.
ein manuelles et ZWave_SW_RGBW rgb FFFFFF funktioniert jedoch
Titel: Antw:Frage zu notify
Beitrag von: Beta-User am 22 Februar 2019, 16:34:26
ReadingsVal ist eine Perl-Funktion. Du nutzt das so, als wäre es ein FHEM-Befehl. Folge: Fehler...

Ungetestet:
ZWave_SW_Voute_Esszimmer.on {if Value('ZWave_SW_RGBW') eq "off" { fhem "set ZWave_SW_RGBW rgb ReadingsVal('ZWave_SW_RGBW','_lastRGBhex','FFFFFF')"}}
Oder mit invertiertem if:
ZWave_SW_Voute_Esszimmer.on { fhem "set ZWave_SW_RGBW rgb ReadingsVal('ZWave_SW_RGBW','_lastRGBhex','FFFFFF')" if Value('ZWave_SW_RGBW') eq "off" }

Titel: Antw:Frage zu notify
Beitrag von: CoolTux am 22 Februar 2019, 17:11:54

ZWave_SW_Voute_Esszimmer.on
IF ([ZWave_SW_RGBW] eq "off")
(
set ZWave_SW_RGBW rgb [ZWave_SW_RGBW:_lastRGBhex]
)


So sollte es auch gehen. SetMagic
Titel: Antw:Frage zu notify
Beitrag von: justme1968 am 22 Februar 2019, 17:16:03
und ganz ohne perl und IF: ZWave_SW_Voute_Esszimmer.on set ZWave_SW_RGBW:FILTER=state=off rgb [ZWave_SW_RGBW:_lastRGBhex]
Titel: Antw:Frage zu notify
Beitrag von: flipse am 22 Februar 2019, 20:48:57
Vielen Dank.
das hat perfekt geholfen. Die Syntax konnte ich gleich an vielen Stellen einsetzen. Vielen Dank.
Titel: Antw:Frage zu notify
Beitrag von: flipse am 22 Februar 2019, 20:49:45
Zitat von: Beta-User am 22 Februar 2019, 16:34:26
ReadingsVal ist eine Perl-Funktion. Du nutzt das so, als wäre es ein FHEM-Befehl. Folge: Fehler...

Ungetestet:
ZWave_SW_Voute_Esszimmer.on {if Value('ZWave_SW_RGBW') eq "off" { fhem "set ZWave_SW_RGBW rgb ReadingsVal('ZWave_SW_RGBW','_lastRGBhex','FFFFFF')"}}
Oder mit invertiertem if:
ZWave_SW_Voute_Esszimmer.on { fhem "set ZWave_SW_RGBW rgb ReadingsVal('ZWave_SW_RGBW','_lastRGBhex','FFFFFF')" if Value('ZWave_SW_RGBW') eq "off" }

wozu kehrt man das if um?
Titel: Antw:Frage zu notify
Beitrag von: CoolTux am 22 Februar 2019, 21:06:52
Das kann man in Perl so machen. Ist der menschlichen Sprache näher.