Anfängerhilfe für Reading Syntax

Begonnen von jbraeu, 25 Januar 2020, 17:26:01

Vorheriges Thema - Nächstes Thema

jbraeu

Servus, bin neu hier und blutigster Anfänger also bitte nicht gleich steinigen. Danke!

1. textuelle Erklärung zum vorhaben: Ich habe einen Smartmeter DTZ 541, wenn der wg. PV unter 0 Watt fällt möchte ich das ein Shelly1 (Tasmota) für mindestens 2 Stunden einschaltet.
2. Mein Pseudocode: IF Reading(Holley_DTZ_541:power<=0) THEN set (MQTT2_DVES_C4FD20, state=on) Wait 7200

Kann mir jemand bei der Syntax helfen, ich finde einfach nix konkretes, DANKESCHÖN!

Gruß Josef

CoolTux

Du kannst ein Notify verwenden und machst dann ein set on-for-timer auf den Shelly
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

jbraeu

kannst du das in code konkretisieren

CoolTux

Dann wäre ein list der bereiligten Devices sehr hilfreich

list smartmeter
list shelly
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

jbraeu

#4
aus Monitor:
MQTT2_DEVICE MQTT2_DVES_C4FD20 set_on
MQTT2_DEVICE MQTT2_DVES_C4FD20 set_off

----------------------------------------------
Smartmeter
----------------------------------------------
Internals:
   DEF        /dev/ttyUSB0@9600,8,N,1 SML
   DeviceName /dev/ttyUSB0@9600,8,N,1
   FD         11
   FUUID      5e1312c1-f33f-20ab-6173-f569aaaca4221d5f
   MeterType  SML
   NAME       Holley_DTZ_541
   NR         56
   PARTIAL   
   STATE      opened
   TYPE       OBIS
   READINGS:
     2020-01-25 17:58:12   1.0.0.2.0.255   1.02.007
     2020-01-25 17:58:12   1.0.14.7.0.255  50
     2020-01-25 17:58:12   1.0.81.7.1.255  240
     2020-01-25 17:58:12   1.0.81.7.15.255 311
     2020-01-25 17:58:12   1.0.81.7.2.255  119
     2020-01-25 17:58:12   1.0.81.7.26.255 29
     2020-01-25 17:58:12   1.0.81.7.4.255  324
     2020-01-09 20:51:32   1.0.96.229.27.255 0
     2020-01-25 17:58:12   1.0.96.5.0.255  1868036
     2020-01-25 17:58:12   1.0.96.50.1.255 HLY
     2020-01-25 17:58:12   1.0.96.90.2.255 A01A
     2020-01-09 00:38:03   1.224.27.27.27.255 0
     2020-01-25 17:58:12   current_L1      1.77
     2020-01-25 17:58:12   current_L2      1.48
     2020-01-25 17:58:12   current_L3      0.78
     2020-01-25 17:58:12   einspeisung_kwh 1630.774
     2020-01-25 17:58:12   power           723
     2020-01-25 17:08:10   state           opened
     2020-01-25 17:58:12   total_consumption 2936663.2
     2020-01-25 17:58:12   total_feed      1630774
     2020-01-25 08:09:07   total_kwh       1628.642
     2020-01-25 17:58:12   voltage_L1      229.9
     2020-01-25 17:58:12   voltage_L2      229.6
     2020-01-25 17:58:12   voltage_L3      229.8
   helper:
     BUFFER     
     EoM        1
     SPEED      5
     SPEED2     5
     TRIGGERTIME 1579968490.05483
     Channels:
     DEVICES:
       
       60
       
     directions:
Attributes:
   event-on-change-reading .*
   icon       FS20.on
   interval   60
   room       Stromzaehler
   userReadings einspeisung_kwh {ReadingsVal("Holley_DTZ_541","total_feed",0)/1000}
----------------------------------------------
Shelly
----------------------------------------------
Internals:
   CID        DVES_C4FD20
   DEF        DVES_C4FD20
   DEVICETOPIC MQTT2_DVES_C4FD20
   FUUID      5e2c6293-f33f-20ab-c302-26e09f8df75e61d1
   IODev      m2server
   LASTInputDev m2server
   MSGCNT     30
   NAME       MQTT2_DVES_C4FD20
   NR         112
   STATE      off
   TYPE       MQTT2_DEVICE
   m2server_MSGCNT 30
   m2server_TIME 2020-01-25 17:57:32
   JSONMAP:
     POWER1     state
   READINGS:
     2020-01-25 17:57:22   FallbackTopic   cmnd/DVES_C4FD20_fb/
     2020-01-25 17:57:22   GroupTopic      cmnd/tasmotas/
     2020-01-25 17:57:26   Heap            28
     2020-01-25 17:57:22   Hostname        SHELLY_1-7456
     2020-01-25 17:57:22   IPAddress       192.168.178.134
     2020-01-25 17:57:22   LWT             Online
     2020-01-25 17:57:26   LoadAvg         19
     2020-01-25 17:57:22   Module          Shelly 1
     2020-01-25 17:57:26   MqttCount       1
     2020-01-25 17:57:22   RestartReason   Power on
     2020-01-25 16:57:45   SaveData        on
     2020-01-25 16:57:45   SetOption26     on
     2020-01-25 17:57:26   Sleep           50
     2020-01-25 17:57:26   SleepMode       Dynamic
     2020-01-25 16:57:44   StateText1      off
     2020-01-25 16:57:44   StateText2      on
     2020-01-25 16:57:44   StateText3      toggle
     2020-01-25 16:57:45   StateText4      hold
     2020-01-25 17:57:26   Switch1         off
     2020-01-25 17:57:26   Time            2020-01-25T17:57:25
     2020-01-25 17:57:26   Uptime          0T00:00:12
     2020-01-25 17:57:26   UptimeSec       12
     2020-01-25 17:57:22   Version         8.1.0(tasmota)
     2020-01-25 17:57:22   WebServerMode   Admin
     2020-01-25 17:57:26   Wifi_AP         1
     2020-01-25 17:57:26   Wifi_BSSId      B4:FB:E4:4D:94:2C
     2020-01-25 17:57:26   Wifi_Channel    11
     2020-01-25 17:57:26   Wifi_Downtime   0T00:00:06
     2020-01-25 17:57:26   Wifi_LinkCount  1
     2020-01-25 17:57:26   Wifi_RSSI       56
     2020-01-25 17:57:26   Wifi_SSId       ***
     2020-01-25 17:57:26   Wifi_Signal     -72
     2020-01-25 17:57:32   state           off
     2020-01-25 17:09:10   subscriptions   cmnd/DVES_C4FD20_fb/# cmnd/SHELLY_1/# cmnd/tasmotas/#
Attributes:
   IODev      m2server
   autocreate 0
   comment    NOTE: For on-for-timer SetExtensions are used. You may add on-for-timer option running on the device. The following is limited to 1h max duration, but will not affect future simple "on" commands:<br>on-for-timer {my $duration = $EVTPART1*10; 'cmnd/cmnd/SHELLY_1/Backlog POWER1 1; delay '.$duration.'; POWER1 0'}<br>See the "Praxisbeispiele" in the wiki for "pulseTime1" alternative option and it's restrictions.
   icon       hue_filled_outlet
   jsonMap    POWER1:state
   model      tasmota_basic_state_power1
   readingList tele/SHELLY_1/LWT:.* LWT
  tele/SHELLY_1/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }
  tele/SHELLY_1/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }
  tele/SHELLY_1/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }
  tele/SHELLY_1/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }
  stat/SHELLY_1/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }
   room       MQTT2_DEVICE
   setList    off:noArg    cmnd/SHELLY_1/POWER1 0
  on:noArg     cmnd/SHELLY_1/POWER1 1
  toggle:noArg cmnd/SHELLY_1/POWER1 2
  setOtaUrl:textField cmnd/SHELLY_1/OtaUrl $EVTPART1
  upgrade:noArg   cmnd/SHELLY_1/upgrade 1
   setStateList on off toggle

CoolTux

Bitte solche Ausgaben immer in Codetags setzen.


Und eine Erklärung was wie so genau wäre noch schön.

Also Welches Reading vom Device Holley_DTZ_541 soll welchen Wert haben damit der Shelly sich ein schaltet?
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

jbraeu

Also wenn Gerät: Holley_DTZ_541 Wert: power unter 0 fällt dann soll das Gerät MQTT2_DVES_C4FD20 Wert: state on geschaltet werden.
Das ganze soll 2 Stunden nicht mehr geprüft werden mit Pause, oder einer Schleife?

Hintergrund:
Es geht darum den Eigenen PV Strom besser zu nutzen, ich möchte div. Geräte z.B. Lüftungsanlage einschalten wenn die Sonne scheint aber natürlich nicht gleich wieder ausschalten wenn eine Wolke drüber zieht. Das wäre denkbar für WM, Trockner, Spülmaschine etc. falls die das so trivial unterstützen würden. Ich hoffe ich konnte den Ansatz rüberbringen?

CoolTux

userreadings noPower:power.* { (ReadingsVal($name,'power',100) < 0 ? 'true' : 'false') }

Und dann ein Nottify

define myNotifyName notify Holley_DTZ_541:noPower:.true set MQTT2_DVES_C4FD20 on-for-timer 7200

Das ist die einfachste Form. Sobald Power unter 0 fällt wechselt noPwer auf true und löst das Notify aus
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

jbraeu

Danke für den Code!

Also ich habe das Reading als Attribut am Smartmeter eingetragen mit:
attr Holley_DTZ_541 userReadings noPower:power.* { (ReadingsVal($name,'power',100) < 0 ? 'true' : 'false') }

und den notify so eingetragen:
define myNotify_Einspeisung notify Holley_DTZ_541:noPower:.true set MQTT2_DVES_C4FD20 on-for-timer 7200

hundertausendmal Vielen Lieben Dank dafür!