Waschmaschinen Status mit TelegramBot

Begonnen von coolice, 14 Oktober 2017, 10:48:03

Vorheriges Thema - Nächstes Thema

coolice

Hallo, ich versuche meine Waschmaschine mittels einer HM-ES-PMSw1-Pl einzubinden.
Ich habe einen dummy Waschmaschine.Status list Internals:
   CHANGED
   NAME       Waschmaschine.Status
   NR         356
   STATE      running
   TYPE       dummy
   READINGS:
     2017-10-08 18:55:53   ZeitFertig      18:55
     2017-10-14 10:15:48   ZeitStart       10:15
     2017-10-14 10:38:04   energy          4358.3
     2017-10-14 10:38:04   power           124.04
     2017-10-08 19:10:48   preEnergy       3878.5
     2017-10-14 10:15:48   state           running
     2017-10-14 10:38:04   switch          on
Attributes:
   configPowerDone 3
   configPowerOff 1
   configTimerAutoOff 900
   configWaitDone 60
   configWaitOff 5
   event-on-change-reading state, energy
   event-on-update-reading power
   group      Waschmaschine
   room       1.11_Keller
   userattr   configPowerOff configWaitOff configPowerDone configWaitDone configTimerAutoOff

sowie drei DOIF. Einmal WaschmaschineSync der die Daten der HM-ES-PMSw1-Pl an den dummy übertragen soll Internals:
   DEF        ([KG.wk.Waschmaschine_Pwr:power] or [KG.wk.Waschmaschine_Pwr:energy] or [KG.wk.Waschmaschine_Sw:state]) (setreading Waschmaschine.Status power [KG.wk.Waschmaschine_Pwr:power],setreading Waschmaschine.Status energy [KG.wk.Waschmaschine_Pwr:energy],setreading Waschmaschine.Status switch [KG.wk.Waschmaschine_Sw:state])
   NAME       di_WaschmaschineSync
   NR         355
   NTFY_ORDER 50-di_WaschmaschineSync
   STATE      cmd_1
   TYPE       DOIF
   READINGS:
     2017-10-14 10:40:35   Device          KG.wk.Waschmaschine_Pwr
     2017-10-14 10:40:35   cmd             1
     2017-10-14 10:40:35   cmd_event       KG.wk.Waschmaschine_Pwr
     2017-10-14 10:40:35   cmd_nr          1
     2017-10-14 10:40:35   e_KG.wk.Waschmaschine_Pwr_energy 4361.7
     2017-10-14 10:40:35   e_KG.wk.Waschmaschine_Pwr_power 1.43
     2017-10-14 10:03:57   e_KG.wk.Waschmaschine_Sw_state on
     2017-10-14 10:40:35   state           cmd_1
   condition:
     0          ReadingValDoIf($hash,'KG.wk.Waschmaschine_Pwr','power') or ReadingValDoIf($hash,'KG.wk.Waschmaschine_Pwr','energy') or ReadingValDoIf($hash,'KG.wk.Waschmaschine_Sw','state')
   devices:
     0           KG.wk.Waschmaschine_Pwr KG.wk.Waschmaschine_Sw
     all         KG.wk.Waschmaschine_Pwr KG.wk.Waschmaschine_Sw
   do:
     0:
       0          setreading Waschmaschine.Status power [KG.wk.Waschmaschine_Pwr:power],setreading Waschmaschine.Status energy [KG.wk.Waschmaschine_Pwr:energy],setreading Waschmaschine.Status switch [KG.wk.Waschmaschine_Sw:state]
     1:
   helper:
     event      boot: off,current: 46,eState: E: 4361.7 P: 1.43 I: 46 U: 222.3 f: 49.99,energy: 4361.7,energyCalc: 4361.7,frequency: 49.99,power: 1.43,4361.7,voltage: 222.3
     globalinit 1
     last_timer 0
     sleeptimer -1
     timerdev   KG.wk.Waschmaschine_Pwr
     timerevent boot: off,current: 46,eState: E: 4361.7 P: 1.43 I: 46 U: 222.3 f: 49.99,energy: 4361.7,energyCalc: 4361.7,frequency: 49.99,power: 1.43,4361.7,voltage: 222.3
     triggerDev KG.wk.Waschmaschine_Pwr
     timerevents:
       boot: off
       current: 46
       eState: E: 4361.7 P: 1.43 I: 46 U: 222.3 f: 49.99
       energy: 4361.7
       energyCalc: 4361.7
       frequency: 49.99
       power: 1.43
       4361.7
       voltage: 222.3
     timereventsState:
       boot: off
       current: 46
       eState: E: 4361.7 P: 1.43 I: 46 U: 222.3 f: 49.99
       energy: 4361.7
       energyCalc: 4361.7
       frequency: 49.99
       power: 1.43
       state: 4361.7
       voltage: 222.3
     triggerEvents:
       boot: off
       current: 46
       eState: E: 4361.7 P: 1.43 I: 46 U: 222.3 f: 49.99
       energy: 4361.7
       energyCalc: 4361.7
       frequency: 49.99
       power: 1.43
       4361.7
       voltage: 222.3
     triggerEventsState:
       boot: off
       current: 46
       eState: E: 4361.7 P: 1.43 I: 46 U: 222.3 f: 49.99
       energy: 4361.7
       energyCalc: 4361.7
       frequency: 49.99
       power: 1.43
       state: 4361.7
       voltage: 222.3
   internals:
   itimer:
   readings:
     0           KG.wk.Waschmaschine_Pwr:power KG.wk.Waschmaschine_Pwr:energy KG.wk.Waschmaschine_Sw:state
     all         KG.wk.Waschmaschine_Pwr:power KG.wk.Waschmaschine_Pwr:energy KG.wk.Waschmaschine_Sw:state
   regexp:
     0:
     all:
   state:
     STATE:
   trigger:
Attributes:
   do         always
   room       8.2_DOIF
was er auch tut und dann noch WaschmaschineStatus Internals:
   DEF        ([Waschmaschine.Status:power] >= AttrVal("Waschmaschine.Status", "configPowerOff", 1) and [Waschmaschine.Status:state] eq 'off') ( set Waschmaschine.Status on, setreading Waschmaschine.Status preEnergy [Waschmaschine.Status:energy] )  DOELSEIF ([Waschmaschine.Status:power] >= AttrVal("Waschmaschine.Status", "configPowerDone", 3)) ( set Waschmaschine.Status running, {fhem 'setreading Waschmaschine.Status ZeitStart '.strftime('%H:%M', localtime)}, ) DOELSEIF ([Waschmaschine.Status:state] eq 'done' and [Waschmaschine.Status:power] < AttrVal("Waschmaschine.Status", "configPowerOff", 1)) ( set Waschmaschine.Status off )  DOELSEIF ([Waschmaschine.Status:power] < AttrVal("Waschmaschine.Status", "configPowerDone", 3) and [Waschmaschine.Status:state] eq 'running') ( set Waschmaschine.Status done, {fhem 'setreading Waschmaschine.Status ZeitFertig '.strftime('%H:%M', localtime)}, setreading Waschmaschine.Status lastEnergy {([Waschmaschine.Status:energy]-[Waschmaschine.Status:preEnergy])}, setreading Waschmaschine.Status totalEnergy {([Waschmaschine.Status:totalEnergy]+[Waschmaschine.Status:lastEnergy])}, setreading Waschmaschine.Status lastCost {(round(([Waschmaschine.Status:lastEnergy]/1000*0.25),2))}, setreading Waschmaschine.Status totalCost {(round(([Waschmaschine.Status:totalEnergy]/1000*0.25),2))}, setreading Waschmaschine.Status preEnergy [Waschmaschine.Status:energy], msg @rr_Mirco -1 |WASCHRAUM| Waschmaschine fertig. Bitte die Wäsche aufhängen! - [Waschmaschine.Status:lastCost]€,  (msg push,audio @rr_Andrea |WASCHRAUM| Die Waschmaschine ist fertig. Bitte die Wäsche aufhängen! - [Waschmaschine.Status:lastCost]€) )
   NAME       di_WaschmaschineStatus
   NR         357
   NTFY_ORDER 50-di_WaschmaschineStatus
   STATE      cmd_2
   TYPE       DOIF
   READINGS:
     2017-10-14 10:42:51   Device          Waschmaschine.Status
     2017-10-14 10:15:48   cmd             2
     2017-10-14 10:15:48   cmd_event       Waschmaschine.Status
     2017-10-14 10:15:48   cmd_nr          2
     2017-10-14 10:42:51   e_Waschmaschine.Status_power 122.69
     2017-10-14 10:42:51   e_Waschmaschine.Status_state running
     2017-10-14 10:15:48   state           cmd_2
     2017-10-14 10:42:13   wait_timer      no timer
   condition:
     0          ReadingValDoIf($hash,'Waschmaschine.Status','power') >= AttrVal("Waschmaschine.Status", "configPowerOff", 1) and ReadingValDoIf($hash,'Waschmaschine.Status','state') eq 'off'
     1          ReadingValDoIf($hash,'Waschmaschine.Status','power') >= AttrVal("Waschmaschine.Status", "configPowerDone", 3)
     2          ReadingValDoIf($hash,'Waschmaschine.Status','state') eq 'done' and ReadingValDoIf($hash,'Waschmaschine.Status','power') < AttrVal("Waschmaschine.Status", "configPowerOff", 1)
     3          ReadingValDoIf($hash,'Waschmaschine.Status','power') < AttrVal("Waschmaschine.Status", "configPowerDone", 3) and ReadingValDoIf($hash,'Waschmaschine.Status','state') eq 'running'
   devices:
     0           Waschmaschine.Status
     1           Waschmaschine.Status
     2           Waschmaschine.Status
     3           Waschmaschine.Status
     all         Waschmaschine.Status
   do:
     0:
       0            set Waschmaschine.Status on, setreading Waschmaschine.Status preEnergy [Waschmaschine.Status:energy]
     1:
       0            set Waschmaschine.Status running, {fhem 'setreading Waschmaschine.Status ZeitStart '.strftime('%H:%M', localtime)},
     2:
       0            set Waschmaschine.Status off
     3:
       0            set Waschmaschine.Status done, {fhem 'setreading Waschmaschine.Status ZeitFertig '.strftime('%H:%M', localtime)}, setreading Waschmaschine.Status lastEnergy {([Waschmaschine.Status:energy]-[Waschmaschine.Status:preEnergy])}, setreading Waschmaschine.Status totalEnergy {([Waschmaschine.Status:totalEnergy]+[Waschmaschine.Status:lastEnergy])}, setreading Waschmaschine.Status lastCost {(round(([Waschmaschine.Status:lastEnergy]/1000*0.25),2))}, setreading Waschmaschine.Status totalCost {(round(([Waschmaschine.Status:totalEnergy]/1000*0.25),2))}, setreading Waschmaschine.Status preEnergy [Waschmaschine.Status:energy], msg @rr_Mirco -1 |WASCHRAUM| Waschmaschine fertig. Bitte die Wäsche aufhängen! - [Waschmaschine.Status:lastCost]€,  (msg push,audio @rr_Andrea |WASCHRAUM| Die Waschmaschine ist fertig. Bitte die Wäsche aufhängen! - [Waschmaschine.Status:lastCost]€)
     4:
   helper:
     event      power: 122.69
     globalinit 1
     last_timer 0
     sleepdevice Waschmaschine.Status
     sleepsubtimer 0
     sleeptimer -1
     timerdev   Waschmaschine.Status
     timerevent power: 122.69
     triggerDev Waschmaschine.Status
     timerevents:
       power: 122.69
     timereventsState:
       power: 122.69
     triggerEvents:
       power: 122.69
     triggerEventsState:
       power: 122.69
   internals:
   itimer:
   readings:
     0           Waschmaschine.Status:power Waschmaschine.Status:state
     1           Waschmaschine.Status:power
     2           Waschmaschine.Status:state Waschmaschine.Status:power
     3           Waschmaschine.Status:power Waschmaschine.Status:state
     all         Waschmaschine.Status:power Waschmaschine.Status:state
   regexp:
     0:
     1:
     2:
     3:
     all:
   state:
     STATE:
   trigger:
Attributes:
   room       8.2_DOIF
   wait       60:60:60:180
welches eigentlich auf die Werte reagieren soll und als letztes das DOIF für die Benachrichtigung ([Waschmaschine.Status:state] eq "done") (set TelegramBotAndrea msg 'Waschmaschine ist fertig') Im großen und ganzen läuft das auch, was allerdings nicht funktioniert wie es soll ist das wenn ich den HM-ES-PMSw1-Pl über den Knopf einschalte und die Waschmaschine anstelle der dummy Waschmaschine.Status auf on bzw. running geht.

Würde einer der Profis mal über den Code gucken ob er das richtig stellen kann. Dankeschön vorab.

Sonniges WE

coolice

Keiner ?


Gesendet von iPhone mit Tapatalk

CBSnake

Guten Morgen,

warum die Dummy-Geschichte?
Theoretisch reicht ein DOIF, das schaut auf das Power Reading vom HM-ES-PMSw1-Pl.
Wenn größer als X ist davon auszugehen, die Maschine läuft. Bei uns gibts dann Nachrichten aufs Handy ala Wer nutzt die Waschmaschine?
Das wird dann vom jeweiligen Nutzer bestätigt.
Ist des Power Reading kleiner als Y ist davon auszugehen die Maschine ist fertig, was wieder eine Nachricht an den eingetragenen Nutzer auslöst :-)

Grüße
Achim
FHEM auf Debian 10, HM-Wlan, JeeLink-Wlan, Wlanduino, ConBee, TP-Link Steckdose, GHoma Steckdosen, Shelly Steckdosen

loescher

Hi!

Da gibt es wie immer mehrere Möglichkeiten.
Kannst dich ja gerne von meiner Lösung inspirieren lassen:
http://loescher-online.de/smarthome.html#waschmaschine

LG,
Stephan.

LaMa163

Zitat von: loescher am 20 Oktober 2017, 22:36:57
Hi!

Da gibt es wie immer mehrere Möglichkeiten.
Kannst dich ja gerne von meiner Lösung inspirieren lassen:
http://loescher-online.de/smarthome.html#waschmaschine

LG,
Stephan.
Wo muss man denn den Programmcode für define Programm.Waschmaschine.Status DOIF einfügen?

Gesendet von meinem SM-T580 mit Tapatalk


loescher

Hi!

Das ist am einfachsten per Telnet ins FHEM einzugeben, also:


telnet MEIN_SERVER_AUF_DEM_FHEM_LÄUFT 7072


und dann einfach rein-pasten.
Ende mit quit.

LG,
Stephan.