[gelöst] Name von ReadingsVal Device

Begonnen von TWART016, 29 März 2018, 00:08:18

Vorheriges Thema - Nächstes Thema

TWART016

In dem Userreading bei input_custom:input?

CoolTux


input_custom:input:.* {my %list=(12 => 'Fernseher', 'video6' => 'Computer', 'dvd' => 'KODI', 'video2' => 'NUC', 'video3' => 'PlayStation', '2E' => 'Bluetooth'); if( defined($list{ReadingsVal($name,'input',0)}) { $list{ReadingsVal($name,'input',0)} else { 'none' } }

Ungetestet
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

TWART016

Das gibt noch einen Fehler
Error evaluating avr userReading input_custom: syntax error at (eval 237897) line 9, near ") {"


Die Klammer von dem IF wird auch nicht zugemacht. Auch wenn ich die schließe, bekomme ich trotzdem den gleichen Fehler.

Hier nochmal der aktuelle Code
input_id_fernseher {AttrVal($name,"input_id_fernseher",0) ;;},
input_id_computer {AttrVal($name,"input_id_computer",0) ;;},
input_id_bluetooth {AttrVal($name,"input_id_bluetooth",0) ;;},
input_id_playstation {AttrVal($name,"input_id_playstation",0) ;;},
input_id_kodi {AttrVal($name,"input_id_kodi",0) ;;},
input_id_nuc {AttrVal($name,"input_id_nuc",0) ;;},
input_custom:input:.* {
my $input_fernseher=AttrVal($name,"input_id_fernseher","");
my $input_computer=AttrVal($name,"input_id_computer","");
my $input_bluetooth=AttrVal($name,"input_id_bluetooth","");
my $input_playstation=AttrVal($name,"input_id_playstation","");
my $input_kodi=AttrVal($name,"input_id_kodi","");
my $input_nuc=AttrVal($name,"input_id_nuc","");
fhem ("set Telegram msg" .$name);
my %list=($input_fernseher => 'Fernseher', $input_computer => 'Computer', $input_kodi => 'KODI', $input_nuc => 'NUC', $input_playstation => 'PlayStation', $input_bluetooth => 'Bluetooth');If( defined($list{ReadingsVal($name,'input',0)}) { $list{ReadingsVal($name,'input',0)} else { 'none' } }
},

CoolTux

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

TWART016

Trotzdem noch der Fehler.
if( defined($list{ReadingsVal($name,'input',0)}) { $list{ReadingsVal($name,'input',0)} else { 'none' } })

Ich habe die Klammer am Ende geschlossen.

CoolTux

Die letzte Runde Klammer ist falsch
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

TWART016

Auch ohne die Klammer kommt der Fehler.
Wenn ich mir die Syntax ansehe, wird die runde Klammer vom if nicht geschlossen.

CoolTux


input_custom:input:.* {my %list=(12 => 'Fernseher', 'video6' => 'Computer', 'dvd' => 'KODI', 'video2' => 'NUC', 'video3' => 'PlayStation', '2E' => 'Bluetooth'); if( defined($list{ReadingsVal($name,'input',0)})) { $list{ReadingsVal($name,'input',0)} else { 'none' } }


So sollte es gehen.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

TWART016

Danke, es hat zwar noch eine Klammer gefehlt, aber jetzt funktioniert alles.

if( defined($list{ReadingsVal($name,'input',0)})) { $list{ReadingsVal($name,'input',0)}} else { 'none' }