MAX! dummy Synchronisieren

Begonnen von Himi, 22 Januar 2015, 15:48:41

Vorheriges Thema - Nächstes Thema

Himi

Hallo elfrinjo,

deinen Beitrag habe ich im Prinzip verstanden...

den Code von fruit habe ich angepasst von DEF=HeatingThermostat.* in ---> DEF=MAX_0b2632.* Das ist ja mein Wohnzimmer Thermostat.

Beim abspeichern der fhem.config erhalte ich nun folgende Meldung.

ERROR:
IF: no left bracket: Unknown command {, try help. Unknown command my, try help. Unknown command foreach, try help. Unknown command {, try help. IF: no left bracket: Unknown command {, try help. Unknown command fhem, try help. Unknown command }, try help. Unknown command }, try help. Unknown command }, try help. Unknown command elsif, try help. Unknown command {, try help. Unknown command my, try help. Unknown command foreach, try help. Unknown command {, try help. IF: no left bracket: Unknown command {, try help. Unknown command fhem, try help. Unknown command }, try help. Unknown command }, try help. Unknown command }, try help. Unknown command elsif, try help. Unknown command {, try help. Unknown command my, try help. Unknown command foreach, try help. Unknown command {, try help. IF: no left bracket: Unknown command {, try help. Unknown command fhem, try help. Unknown command }, try help. Unknown command }, try help. Unknown command }, try help. Unknown command }, try help. Unknown command my, try help. Unknown command my, try help. Unknown command my, try help. Unknown command foreach, try help. Unknown command {, try help. IF: no left bracket: Unknown command {, try help. Unknown command $eco++, try help. Unknown command }, try help. Unknown command elsif, try help. Unknown command {, try help. Unknown command $auto++, try help. Unknown command }, try help. Unknown command }, try help. IF: no left bracket: Unknown command {, try help. Unknown command fhem, try help. Unknown command }, try help. Unknown command else, try help. Unknown command {, try help. Unknown command fhem, try help. Unknown command }, try help. Unknown command }, try help.

Da stimmt noch was nicht ganz..

Danke im Voruas für die Hilfe!

nesges

Das sieht nach dem Ergebnis einer Mischung von Perl- und fhem-Code aus und ich vermute du hast "IF" geschrieben, wo du hättest "if" schreiben sollen. "IF" ist ein fhem-Modul, "if" ist Perl. Aber um das genauer zu sagen, müsste man deinen Code mal sehen.

Himi

anbei der Code den ich im Beitrag weiter vorne von fruit übernommen und in DEF=MAX_0b2632.* abgeändert habe.

define ecoSwitch_dummy dummy
attr ecoSwitch_dummy room Heat_Control,MAX
attr ecoSwitch_dummy setList auto comfort eco

define eco_Switch_notify notify .*ecoSwitch_dummy.* {
if ( Value ( "ecoSwitch_dummy" ) eq "auto" )
{
  my @@MAX_HT = devspec2array( "DEF=MAX_0b2632.*" );
  foreach ( @@MAX_HT )
  {
   if ( ReadingsVal ( $_, "mode", "off" ) ne "auto" )
   {
    fhem ( "set $_ desiredTemperature auto" );
   }
  }
}
elsif ( Value ( "ecoSwitch_dummy" ) eq "eco" )
{
  my @@MAX_HT = devspec2array( "DEF=MAX_0b2632.*" );
  foreach ( @@MAX_HT )
  {
   if ( ReadingsVal ( $_, "mode", "off" ) ne "eco" )
   {
    fhem ( "set $_ desiredTemperature eco" );
   }
  }
}
elsif ( Value ( "ecoSwitch_dummy" ) eq "comfort" )
{
  my @@MAX_HT = devspec2array( "DEF=MAX_0b2632.*" );
  foreach ( @@MAX_HT )
  {
   if ( ReadingsVal ( $_, "mode", "off" ) ne "comfort" )
   {
    fhem ( "set $_ desiredTemperature comfort" );
   }
  }
}
}

define eco_Switch_state_notify notify .*(mode|valveposition).* {
my $eco = 0;
my $auto = 0;
my @@MAX_HT = devspec2array( "DEF=MAX_0b2632.*" );
foreach ( @@MAX_HT )
{
  if ( ReadingsVal ( $_, "mode", "101" ) eq "manual" &&  ReadingsVal ( $_, "desiredTemperature", "30" ) eq ReadingsVal ( $_, "ecoTemperature", "30" ) )
  {
   $eco++;
  }
  elsif ( ReadingsVal ( $_, "mode", "101" ) eq "auto" )
  {
   $auto++;
  }
}
if ( ( $eco == 0 ) && ( $auto != 0 ) )
{
  fhem ( "set ecoSwitch_dummy auto" );
}
else
{
  fhem ( "set ecoSwitch_dummy eco" );
}
}

elfrinjo

#18
... bitte ignorieren ... hier stand viel Mist.

nesges

Zitat von: Himi am 29 Januar 2015, 16:50:52anbei der Code

Hast du den Code direkt so wie er hier steht in die fhem.cfg eingetragen? Dann hast du das gleiche Problem wie der Nachbarthread: Zu wenige Semikolons. http://fhem.de/commandref_DE.html#command erklärt's.

Harald

Wenn ich das richtig sehe, hat Himi ein paar geschwungene Klammern zu viel. Ich meine, dass jeweils in der Zeile mit dem "define" ans Ende keine solche Klammer "{" gehört und am Ende jedes Blocks ist dann "}" auch zu viel, oder?

Harald
Router:AVM7590 1&1 FW:FRITZ!OS 07.56 Anbindung:1&1 50/10 Mb/s, WLAN-Repeater 300E
ELV MAX!Cube, 7xThermostat, ECO, RasPi 4B mit bullseye auf Festplatte,
CUL V 1.67, JeeLink v3_10.1c, nanoCUL, 1xS300TH, 4xHMS100T, 4xELRO, 1xTFA, 2xMAX_FK
ELV MAX!1.4.5, FHEM 5.7 auf RasPi, Kostal PIKO plus

fruit

I have no idea what is causing that error but...

"DEF=HeatingThermostat.*" matches HeatingThermostat + any further characters eg. HeatingThermostat MAX_0b2632

"DEF=MAX_0b2632.*" matches MAX_0b2632 + any further characters - there are none! There is no DEF HeatingThermostat MAX_0b2632!

It should be

DEF HeatingThermostat 0b2632

Try "DEF=.*0b2632"

Feel free to follow up in German if you prefer

elfrinjo

#22
Sorry - meine letzten Posts sind leider in eine etwas falsche Richtung gelaufen....

Wenn du die fhem.cfg direkt editierst, versuch mal bitte Folgendes:


define ecoSwitch_dummy dummy
attr ecoSwitch_dummy room Heat_Control,MAX
attr ecoSwitch_dummy setList auto comfort eco

define eco_Switch_notify notify .*ecoSwitch_dummy.* {\
if ( Value ( "ecoSwitch_dummy" ) eq "auto" )\
{\
  my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
  foreach ( @@MAX_HT )\
  {\
   if ( ReadingsVal ( $_, "mode", "off" ) ne "auto" )\
   {\
    fhem ( "set $_ desiredTemperature auto" );;\
   }\
  }\
}\
elsif ( Value ( "ecoSwitch_dummy" ) eq "eco" )\
{\
  my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
  foreach ( @@MAX_HT )\
  {\
   if ( ReadingsVal ( $_, "mode", "off" ) ne "eco" )\
   {\
    fhem ( "set $_ desiredTemperature eco" );;\
   }\
  }\
}\
elsif ( Value ( "ecoSwitch_dummy" ) eq "comfort" )\
{\
  my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
  foreach ( @@MAX_HT )\
  {\
   if ( ReadingsVal ( $_, "mode", "off" ) ne "comfort" )\
   {\
    fhem ( "set $_ desiredTemperature comfort" );;\
   }\
  }\
}\
}

define eco_Switch_state_notify notify .*(mode|valveposition).* {\
my $eco = 0;;\
my $auto = 0;;\
my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
foreach ( @@MAX_HT )\
{\
  if ( ReadingsVal ( $_, "mode", "101" ) eq "manual" &&  ReadingsVal ( $_, "desiredTemperature", "30" ) eq ReadingsVal ( $_, "ecoTemperature", "30" ) )\
  {\
   $eco++;;\
  }\
  elsif ( ReadingsVal ( $_, "mode", "101" ) eq "auto" )\
  {\
   $auto++;;\
  }\
}\
if ( ( $eco == 0 ) && ( $auto != 0 ) )\
{\
  fhem ( "set ecoSwitch_dummy auto" );;\
}\
else\
{\
  fhem ( "set ecoSwitch_dummy eco" );;\
}\
}

Harald

Ich habe übersehen, dass Himi's Code in der fhem.cfg steht. elfrinjo hat das erkannt und das richtig gestellt. Was ich schrieb, war also nicht richtig. Entschuldigt bitte ...

Harald
Router:AVM7590 1&1 FW:FRITZ!OS 07.56 Anbindung:1&1 50/10 Mb/s, WLAN-Repeater 300E
ELV MAX!Cube, 7xThermostat, ECO, RasPi 4B mit bullseye auf Festplatte,
CUL V 1.67, JeeLink v3_10.1c, nanoCUL, 1xS300TH, 4xHMS100T, 4xELRO, 1xTFA, 2xMAX_FK
ELV MAX!1.4.5, FHEM 5.7 auf RasPi, Kostal PIKO plus

elfrinjo

#24
Zitat von: Harald am 29 Januar 2015, 19:06:18
Ich habe übersehen, dass Himi's Code in der fhem.cfg steht. elfrinjo hat das erkannt und das richtig gestellt. Was ich schrieb, war also nicht richtig. Entschuldigt bitte ...

Harald

ich habe mehr dummes Zeug geredet :)

@Himi, hier wird ein wenig auf die unterschiedlichen Methoden zur Konfiguration eingegangen:
https://groups.google.com/forum/#!topic/fhem-users/z2nXv8Kx-Ck
http://www.fhemwiki.de/wiki/Konfiguration

Himi

Hallo elfrinjo,

jetzt sieht es besser aus, keine Fehlermeldung mehr bei der direkt-editierung in der fhem.config

Morgen werde ich die Funktion testen.

Melde mich wieder.

Ich bin begeistert über euere Unterstützung.

Himi

Himi

Hallo,

sorry, melde ich erst jetzt zurück.

Habe den dummy getestet, der Modus aller eigesetzten HK-Thermostate wird nun richtig ausgelesen und im dummy (z.B. "auto") richtig dargestellt.

Meine gestellte Frage ist somit mit euerer Hilfe beantwortet.  -DANKE-

Nachfolgend nochmals der funktionierente Code-Schnipsel...

Nun hätte ich noch einen Wunsch, wie kann ich den dummy so erweitern, das ich den Heizungsmodus im Haus auch umschalten kann?

Das state sollte sich natürlich immer mit aktualisieren.

define ecoSwitch_dummy dummy
attr ecoSwitch_dummy room Heat_Control,MAX
attr ecoSwitch_dummy setList auto comfort eco

define eco_Switch_notify notify .*ecoSwitch_dummy.* {\
if ( Value ( "ecoSwitch_dummy" ) eq "auto" )\
{\
  my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
  foreach ( @@MAX_HT )\
  {\
   if ( ReadingsVal ( $_, "mode", "off" ) ne "auto" )\
   {\
    fhem ( "set $_ desiredTemperature auto" );;\
   }\
  }\
}\
elsif ( Value ( "ecoSwitch_dummy" ) eq "eco" )\
{\
  my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
  foreach ( @@MAX_HT )\
  {\
   if ( ReadingsVal ( $_, "mode", "off" ) ne "eco" )\
   {\
    fhem ( "set $_ desiredTemperature eco" );;\
   }\
  }\
}\
elsif ( Value ( "ecoSwitch_dummy" ) eq "comfort" )\
{\
  my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
  foreach ( @@MAX_HT )\
  {\
   if ( ReadingsVal ( $_, "mode", "off" ) ne "comfort" )\
   {\
    fhem ( "set $_ desiredTemperature comfort" );;\
   }\
  }\
}\
}

define eco_Switch_state_notify notify .*(mode|valveposition).* {\
my $eco = 0;;\
my $auto = 0;;\
my @@MAX_HT = devspec2array( "DEF=HeatingThermostat.*" );;\
foreach ( @@MAX_HT )\
{\
  if ( ReadingsVal ( $_, "mode", "101" ) eq "manual" &&  ReadingsVal ( $_, "desiredTemperature", "30" ) eq ReadingsVal ( $_, "ecoTemperature", "30" ) )\
  {\
   $eco++;;\
  }\
  elsif ( ReadingsVal ( $_, "mode", "101" ) eq "auto" )\
  {\
   $auto++;;\
  }\
}\
if ( ( $eco == 0 ) && ( $auto != 0 ) )\
{\
  fhem ( "set ecoSwitch_dummy auto" );;\
}\
else\
{\
  fhem ( "set ecoSwitch_dummy eco" );;\
}\
}

elfrinjo

Hi,

der Code zum umschalten ist eigentlich schon da. Das, was unter dem eco_Switch_notify steht muss nur noch ausgelöst werden.
Versuch doch mal dieses Attribut:

attr ecoSwitch_dummy devStateIcon auto:Heizung_Hauptschalter.on:go eco:Heizung_Hauptschalter.off:go

Das Attribut tut Folgendes:
Statt auto oder eco wird ein Icon angezeigt.
Bei Klick auf das Icon wir das Event go (Name ist egal) generiert, was eco_Switch_notify auslöst, welches dann die Heizungen umschaltet.
Der Dummy wird anschließend über die bisherigen Mechanismen aktualisiert.

Himi

Hi,

habe das Attribut im ecoSwitch_dummy eingebaut...

Es wird aber kein Icon sichtbar. (auch nicht nach einem Restart von Fhem)

nachfolgend mein Code

attr ecoSwitch_dummy devStateIcon auto:HeatingThermostat.on:go eco:HeatingThermostat.off:go

elfrinjo

#29
Also zumindest in meinem FHEM ist HeatingThermostat.on auch kein gültiges Icon.
Zwischen den Doppelpunkten muss schon eines von den Symbolen stehen, die über Select Icon oder Extend devStateIcon auswählbar sind.

Das devStateIcon fun ktioniert so:

attr ecoSwitch_dummy devStateIcon auto:Heizung_Hauptschalter.on:go eco:Heizung_Hauptschalter.off:go
                                    ^               ^            ^   ^Und hier das Ganze nochmal falls STATE = eco
                                    |               |            |
                                    |               |            +--- Wenn das Icon gedrückt wird generiere ein
                                    |               |                 Event "go" für den Dummy
                                    |               +--- Zeige das Symbol Heizung_Hauptschalter.on an
                                    +--- Falls der STATE des dummy auto ist



PS: Ich hoffe das ist lesbar...