Hallo Damian,
es geht im Kern um die Frage, ob ich folgende Attribute mit [$SELF ... definieren kann:
attr coolDachboden cmdpause [$SELF:cmdpause_Wert]
attr coolDachboden wait 0,2,2,[$SELF:wait_Wert],2,300-3*2-[$SELF:wait_Wert]:0,2
Die Readings cmdpause_Wert und wait_Wert habe ich im selben Device per userReadings definiert.
Geht das prinzipiell so?
Wenn nicht, was wäre eine vernünftige Lösung?
Hier zur Vollständigkeit das list:
define coolDachboden DOIF ((((([?mySolarForecast:ForecastNoonSolar] + [?mySolarForecast:ForecastAfternoonSolar]) >= 30000 \
or [?Deye_Inverter:pv_total_power:avg5] > 7500) \
and [?mySolarForecast:RestOfDayPVforecast:d] > 5000 \
and [Deye_Inverter:heat_sink_temperature:avg5] >= 45 \
and ([?VaillantaroSTOR:SGReady1] == 1 or [?VaillantaroSTOR:WP_an] == 0)) \
## SGReady1 = 1 --> aus\
or ([Deye_Inverter:heat_sink_temperature:avg5] >= 40 \
and ([?VaillantaroSTOR:SGReady1] == 0 or [?VaillantaroSTOR:WP_an] == 1) \
and [?VaillantaroSTOR:Innentemperatur] >= 57)) \
and 112.5 <= [myAstro:SunAz] <= 242.5 \
## and [?10:00-16:45] \
and [?SpitzbodenVent:TemperaturDS18B20] >= 26 \
and [?HourCount.Magnetventil:countsPerDay] > 0) \
(set Umwaelzpumpe disable) \
(set VaillantaroSTOR _on) \
(set Magnetventil_RL_Heizung _on) \
(set Magnetventil_RL_Heizung _off) \
(set Umwaelzpumpe enable) \
(set VaillantaroSTOR _off) \
## Der 2. Zweig ist nur einmalig gültig.\
## Das Magnetventil öffnet dabei nur kurz.\
DOELSEIF ((((([?mySolarForecast:ForecastNoonSolar] + [?mySolarForecast:ForecastAfternoonSolar]) >= 30000 \
or [?Deye_Inverter:pv_total_power:avg5] > 7500) \
and [?mySolarForecast:RestOfDayPVforecast:d] > 5000 \
and [Deye_Inverter:heat_sink_temperature:avg5] >= 45 \
and ([?VaillantaroSTOR:SGReady1] == 1 or [?VaillantaroSTOR:WP_an] == 0)) \
## SGReady1 = 1 --> aus\
or ([Deye_Inverter:heat_sink_temperature:avg5] >= 40 \
and ([?VaillantaroSTOR:SGReady1] == 0 or [?VaillantaroSTOR:WP_an] == 1) \
and [?VaillantaroSTOR:Innentemperatur] >= 57)) \
and 112.5 <= [myAstro:SunAz] <= 242.5 \
## and [?10:00-16:45] \
and [?SpitzbodenVent:TemperaturDS18B20] >= 26 \
and [?HourCount.Magnetventil:countsPerDay] == 0) \
(set Magnetventil_RL_Heizung _on) \
(set Magnetventil_RL_Heizung _off)
attr coolDachboden alias Magnetventil Rücklauf
attr coolDachboden cmdpause [$SELF:cmdpause_Wert]
attr coolDachboden comment cmdpause_Wert und wait_Wert wird im gleichen DOIF gesetzt.\
Damit wird die Häufigkeit und Länge der Einschaltdauer des Magnetventils gesteuert.
attr coolDachboden do always
attr coolDachboden icon sani_water_tap
attr coolDachboden room DEYE
attr coolDachboden stateFormat {'Laufzeit: '.ReadingsVal('HourCount.Magnetventil','Laufzeit','').'<br/>\
Vaillant: '.round(ReadingsVal('VaillantaroSTOR','Power_W',''),0).' W<br/>\
Forecast<i><span style="vertical-align: -3px;; font-size: 75%;;">n/a</span></i>: '.round((ReadingsNum('mySolarForecast','ForecastNoonSolar','') + ReadingsNum('mySolarForecast','ForecastAfternoonSolar',''))/1000,1).' kWh<br/>\
Temp<i><span style="vertical-align: -3px;; font-size: 75%;;">Dach</span></i>: '.round(ReadingsVal('SpitzbodenVent','TemperaturDS18B20',''),1).'°C<br/>\
Temp<i><span style="vertical-align: -3px;; font-size: 75%;;">Vaillant</span></i>: '.round(ReadingsVal('VaillantaroSTOR','Innentemperatur',''),1).'°C'}
attr coolDachboden userReadings wait_Wert {\
my $t = ReadingsNum("VaillantaroSTOR","Innentemperatur",0);;\
if ($t < 57.5) { 0 }\
else {\
my $dT = $t - 58.25;;\
$dT = 0.75 if $dT > 0.75;;\
$dT = -0.75 if $dT < -0.75;;\
85 + 40 * $dT\
}\
},\
cmdpause_Wert {\
my $t = ReadingsNum("VaillantaroSTOR","Innentemperatur",0);;\
if ($t < 57.5) { 600 }\
else {\
my $dT = $t - 58.25;;\
$dT = 0.75 if $dT > 0.75;;\
$dT = -0.75 if $dT < -0.75;;\
450 - 200 * $dT\
}\
}
attr coolDachboden wait 0,2,2,[$SELF:wait_Wert],2,300-3*2-[$SELF:wait_Wert]:0,2
# CFGFN ./FHEM/Photovoltaik.cfg
# DEF ((((([?mySolarForecast:ForecastNoonSolar] + [?mySolarForecast:ForecastAfternoonSolar]) >= 30000
#or [?Deye_Inverter:pv_total_power:avg5] > 7500)
#and [?mySolarForecast:RestOfDayPVforecast:d] > 5000
#and [Deye_Inverter:heat_sink_temperature:avg5] >= 45
#and ([?VaillantaroSTOR:SGReady1] == 1 or [?VaillantaroSTOR:WP_an] == 0))
### SGReady1 = 1 --> aus
#or ([Deye_Inverter:heat_sink_temperature:avg5] >= 40
#and ([?VaillantaroSTOR:SGReady1] == 0 or [?VaillantaroSTOR:WP_an] == 1)
#and [?VaillantaroSTOR:Innentemperatur] >= 57))
#and 112.5 <= [myAstro:SunAz] <= 242.5
### and [?10:00-16:45]
#and [?SpitzbodenVent:TemperaturDS18B20] >= 26
#and [?HourCount.Magnetventil:countsPerDay] > 0)
#(set Umwaelzpumpe disable)
#(set VaillantaroSTOR _on)
#(set Magnetventil_RL_Heizung _on)
#(set Magnetventil_RL_Heizung _off)
#(set Umwaelzpumpe enable)
#(set VaillantaroSTOR _off)
### Der 2. Zweig ist nur einmalig gültig.
### Das Magnetventil öffnet dabei nur kurz.
#DOELSEIF ((((([?mySolarForecast:ForecastNoonSolar] + [?mySolarForecast:ForecastAfternoonSolar]) >= 30000
#or [?Deye_Inverter:pv_total_power:avg5] > 7500)
#and [?mySolarForecast:RestOfDayPVforecast:d] > 5000
#and [Deye_Inverter:heat_sink_temperature:avg5] >= 45
#and ([?VaillantaroSTOR:SGReady1] == 1 or [?VaillantaroSTOR:WP_an] == 0))
### SGReady1 = 1 --> aus
#or ([Deye_Inverter:heat_sink_temperature:avg5] >= 40
#and ([?VaillantaroSTOR:SGReady1] == 0 or [?VaillantaroSTOR:WP_an] == 1)
#and [?VaillantaroSTOR:Innentemperatur] >= 57))
#and 112.5 <= [myAstro:SunAz] <= 242.5
### and [?10:00-16:45]
#and [?SpitzbodenVent:TemperaturDS18B20] >= 26
#and [?HourCount.Magnetventil:countsPerDay] == 0)
#(set Magnetventil_RL_Heizung _on)
#(set Magnetventil_RL_Heizung _off)
# FUUID 66504f15-f33f-e986-157a-f8742cefe550b178
# MODEL FHEM
# NAME coolDachboden
# NOTIFYDEV global,Deye_Inverter,myAstro
# NR 1616
# NTFY_ORDER 50-coolDachboden
# STATE Laufzeit: 0<span style='vertical-align: +4px;; font-size: 75%;;'>m</span><font size=2> </font>0<span style='vertical-align: +4px;; font-size: 75%;;'>s</span><br/>
#Vaillant: 500 W<br/>
#Forecast<i><span style="vertical-align: -3px; font-size: 75%;">n/a</span></i>: 38.5 kWh<br/>
#Temp<i><span style="vertical-align: -3px; font-size: 75%;">Dach</span></i>: 22.1°C<br/>
#Temp<i><span style="vertical-align: -3px; font-size: 75%;">Vaillant</span></i>: 53.1°C
# TYPE DOIF
# VERSION 31153 2026-04-27 14:40:49
# eventCount 4425
# READINGS:
# 2026-09-24 12:57:08 Device Deye_Inverter
# 2026-09-21 18:29:59 cmd 0
# 2026-09-24 12:57:08 cmdpause_Wert 600
# 2026-09-24 12:57:08 e_Deye_Inverter_heat_sink_temperature 39.93
# 2026-09-24 12:55:01 e_myAstro_SunAz 170.9
# 2026-09-21 18:29:59 mode enabled
# 2026-09-21 18:29:59 state initialized
# 2026-09-24 12:57:08 wait_Wert 0
# Regex:
# accu:
# Deye_Inverter:
# accu:
# heat_sink_temperature ^Deye_Inverter$:^heat_sink_temperature:
# pv_total_power ^Deye_Inverter$:^pv_total_power:
# bar:
# barAvg:
# collect:
# cond:
# Deye_Inverter:
# 0:
# heat_sink_temperature ^Deye_Inverter$:^heat_sink_temperature:
# 1:
# heat_sink_temperature ^Deye_Inverter$:^heat_sink_temperature:
# myAstro:
# 0:
# SunAz ^myAstro$:^SunAz:
# 1:
# SunAz ^myAstro$:^SunAz:
# accu:
# Deye_Inverter heat_sink_temperature:
# dim 5
# value:
# 38.40
# 38.88
# 39.45
# 39.83
# 39.93
# Deye_Inverter pv_total_power:
# dim 5
# value:
# 5513
# 9776
# 9266
# 10284
# 9936
# attr:
# cmdpause:
# [$SELF:cmdpause_Wert]
# wait:
# 0:
# 0
# 2
# 2
# [$SELF:wait_Wert]
# 2
# 300-3*2-[$SELF:wait_Wert]
# 1:
# 0
# 2
# condition:
# 0 ((((::ReadingValDoIf($hash,'mySolarForecast','ForecastNoonSolar') + ::ReadingValDoIf($hash,'mySolarForecast','ForecastAfternoonSolar')) >= 30000 or ::ReadingValDoIf($hash,'Deye_Inverter','pv_total_power','','avg5') > 7500) and ::ReadingValDoIf($hash,'mySolarForecast','RestOfDayPVforecast','','d') > 5000 and ::ReadingValDoIf($hash,'Deye_Inverter','heat_sink_temperature','','avg5') >= 45 and (::ReadingValDoIf($hash,'VaillantaroSTOR','SGReady1') == 1 or ::ReadingValDoIf($hash,'VaillantaroSTOR','WP_an') == 0)) or (::ReadingValDoIf($hash,'Deye_Inverter','heat_sink_temperature','','avg5') >= 40 and (::ReadingValDoIf($hash,'VaillantaroSTOR','SGReady1') == 0 or ::ReadingValDoIf($hash,'VaillantaroSTOR','WP_an') == 1) and ::ReadingValDoIf($hash,'VaillantaroSTOR','Innentemperatur') >= 57)) and 112.5 <= ::ReadingValDoIf($hash,'myAstro','SunAz') <= 242.5 and ::ReadingValDoIf($hash,'SpitzbodenVent','TemperaturDS18B20') >= 26 and ::ReadingValDoIf($hash,'HourCount.Magnetventil','countsPerDay') > 0
# 1 ((((::ReadingValDoIf($hash,'mySolarForecast','ForecastNoonSolar') + ::ReadingValDoIf($hash,'mySolarForecast','ForecastAfternoonSolar')) >= 30000 or ::ReadingValDoIf($hash,'Deye_Inverter','pv_total_power','','avg5') > 7500) and ::ReadingValDoIf($hash,'mySolarForecast','RestOfDayPVforecast','','d') > 5000 and ::ReadingValDoIf($hash,'Deye_Inverter','heat_sink_temperature','','avg5') >= 45 and (::ReadingValDoIf($hash,'VaillantaroSTOR','SGReady1') == 1 or ::ReadingValDoIf($hash,'VaillantaroSTOR','WP_an') == 0)) or (::ReadingValDoIf($hash,'Deye_Inverter','heat_sink_temperature','','avg5') >= 40 and (::ReadingValDoIf($hash,'VaillantaroSTOR','SGReady1') == 0 or ::ReadingValDoIf($hash,'VaillantaroSTOR','WP_an') == 1) and ::ReadingValDoIf($hash,'VaillantaroSTOR','Innentemperatur') >= 57)) and 112.5 <= ::ReadingValDoIf($hash,'myAstro','SunAz') <= 242.5 and ::ReadingValDoIf($hash,'SpitzbodenVent','TemperaturDS18B20') >= 26 and ::ReadingValDoIf($hash,'HourCount.Magnetventil','countsPerDay') == 0
# do:
# 0:
# 0 set Umwaelzpumpe disable
# 1 set VaillantaroSTOR _on
# 2 set Magnetventil_RL_Heizung _on
# 3 set Magnetventil_RL_Heizung _off
# 4 set Umwaelzpumpe enable
# 5 set VaillantaroSTOR _off
# 1:
# 0 set Magnetventil_RL_Heizung _on
# 1 set Magnetventil_RL_Heizung _off
# 2:
# helper:
# NOTIFYDEV global,Deye_Inverter,myAstro
# event heat_sink_temperature: 39.93
# globalinit 1
# last_timer 0
# sleeptimer -1
# triggerDev Deye_Inverter
# bm:
# DOIF_Attr:
# cnt 2258
# dmx -1000
# dtot 0
# dtotcnt 0
# mTS 24.09. 06:42:17
# max 0.427574157714844
# tot 193.084880828857
# mAr:
# set
# coolDachboden
# cmdpause
# 600
# DOIF_Get:
# cnt 25
# dmx -1000
# dtot 0
# dtotcnt 0
# mTS 24.09. 12:30:32
# max 4.88758087158203e-05
# tot 0.00065159797668457
# mAr:
# HASH(0x564b0d3ea118)
# coolDachboden
# ?
# DOIF_Notify:
# cnt 52686
# dmx -1000
# dtot 0
# dtotcnt 0
# mTS 23.09. 04:54:05
# max 0.0145280361175537
# tot 18.5861351490021
# mAr:
# HASH(0x564b0d3ea118)
# HASH(0x564b0a6159d0)
# DOIF_Set:
# cnt 624
# dmx -1000
# dtot 0
# dtotcnt 0
# mTS 21.09. 23:44:45
# max 0.000294923782348633
# tot 0.0568041801452637
# mAr:
# HASH(0x564b0d3ea118)
# coolDachboden
# ?
# triggerEvents:
# heat_sink_temperature: 39.93
# triggerEventsState:
# heat_sink_temperature: 39.93
# internals:
# readings:
# all Deye_Inverter:heat_sink_temperature myAstro:SunAz
# trigger:
# uiState:
# uiTable:
#
setstate coolDachboden Laufzeit: 0<span style='vertical-align: +4px;;;; font-size: 75%;;;;'>m</span><font size=2> </font>0<span style='vertical-align: +4px;;;; font-size: 75%;;;;'>s</span><br/>\
Vaillant: 500 W<br/>\
Forecast<i><span style="vertical-align: -3px;; font-size: 75%;;">n/a</span></i>: 38.5 kWh<br/>\
Temp<i><span style="vertical-align: -3px;; font-size: 75%;;">Dach</span></i>: 22.1°C<br/>\
Temp<i><span style="vertical-align: -3px;; font-size: 75%;;">Vaillant</span></i>: 53.1°C
setstate coolDachboden 2026-09-24 12:57:08 Device Deye_Inverter
setstate coolDachboden 2026-09-21 18:29:59 cmd 0
setstate coolDachboden 2026-09-24 12:57:08 cmdpause_Wert 600
setstate coolDachboden 2026-09-24 12:57:08 e_Deye_Inverter_heat_sink_temperature 39.93
setstate coolDachboden 2026-09-24 12:55:01 e_myAstro_SunAz 170.9
setstate coolDachboden 2026-09-21 18:29:59 mode enabled
setstate coolDachboden 2026-09-21 18:29:59 state initialized
setstate coolDachboden 2026-09-24 12:57:08 wait_Wert 0
Viele Grüße Gisbert