Einbindung (Raspberry API) in FHEM

Mahlzeit,

Da ich hierzu nichts gefunden habe hier eine Vorlage zum einbinden in FHEM.

defmod W12_BBQ HTTPMOD http://192.168.12.39/app.php 60
attr W12_BBQ event-on-change-reading .*
attr W12_BBQ extractAllJSON 1
attr W12_BBQ stateFormat Umgebung : [$name:channel_1_temp:r1] °C<br/>\
Garraum: [$name:channel_0_temp:r1] °C<br/>\
Fleisch 1: [$name:channel_3_temp:r1] °C<br/>\
Fleisch 2: [$name:channel_6_temp:r1] °C<br/>\
Garraum Soll [$name:pit_setpoint] °C / Lüfter [$name:pit_control_out] %
attr W12_BBQ webCmd start:stop

vielleicht kann es ja jmd brauchen. :)
Grüße
Frank
 
LOL! sehe gerade die Foren-Software hat da automatisch Smileys erkannt. ;-)
das in der vorletzten Zeile soll natürlich so aussehen:
1691737371586.png
 

Stephan.Braun

New member
Vielen Dank an Frank_Huber für das Auslesen über MQTT:
attr WlanThermo stateFormat Probe 1: [$name:data_channel_1_temp:r1] °C / Probe 2: [$name:data_channel_2_temp:r1] °C / Probe 3: [$name:data_channel_3_temp:r1] °C \\
<br/>\\
Pit ist: [$name:data_channel_4_temp:r1] °C<br/>\\
Pit set: [$name:data_pitmaster_pm_1_set:r0] °C / FAN [$name:data_pitmaster_pm_1_value:r0] %<br/>\\
<br/>\\
WLANThermo Akkustand: [$name:data_system_soc] %
 

Stephan.Braun

New member
Einbinden zum Schreiben funktioniert z.B. so:
define WlanThermo MQTT2_DEVICE esp32_xxxx
setuuid WlanThermo 65299c9f-f33f-2b94-0e2e-42xxxx
attr WlanThermo IODev m2s
attr WlanThermo devicetopic esp32_xxxx
attr WlanThermo getList data:noArg in_mode WLanThermo/MINIV3/get/data\
settings:noArg in_mode WLanThermo/MINIV3/get/settings {}\
pitmater:noArg in_mode WLanThermo/MINIV3/set/pitmaster [{"id":0,"channel":4,"pid":1,"value":0,"set":62.00,"typ":"off"}]
attr WlanThermo icon scene_stove
attr WlanThermo readingList esp32_xxxx:WLanThermo/MINIV3/status/settings:.* { json2nameValue($EVENT, 'settings_', $JSONMAP) }\
esp32_xxxx:WLanThermo/MINIV3/status/data:.* { $EVENT =~ s/"temp":999.00/"temp":"--"/g;;;; json2nameValue($EVENT, 'data_', $JSONMAP) }
attr WlanThermo room MQTT2_DEVICE
attr WlanThermo setList P1Set WLanThermo/MINIV3/set/pitmaster [{"id":0,"channel":4,"pid":1,"value":0,"set":$EVTPART1.00,"typ":"auto"}]\
C1Min { my $temp=ReadingsVal($NAME,"data_channel_1_max_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq {WLanThermo/MINIV3/set/channels {"number":1,"name":"Probe 1","typ":0,"temp":24.50,"min":$EVTPART1.00,"max":$temp.00,"alarm":$alarm,"color":"#0C4C88"}};; }\
C1Max { my $temp=ReadingsVal($NAME,"data_channel_1_min_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq { WLanThermo/MINIV3/set/channels {"number":1,"name":"Probe 1","typ":0,"temp":24.50,"min":$temp.00,"max":$EVTPART1.00,"alarm":$alarm,"color":"#0C4C88"}};; }\
C2Min { my $temp=ReadingsVal($NAME,"data_channel_2_max_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq {WLanThermo/MINIV3/set/channels {"number":2,"name":"Probe 2","typ":0,"temp":24.50,"min":$EVTPART1.00,"max":$temp.00,"alarm":$alarm,"color":"#22B14C"}};; }\
C2Max { my $temp=ReadingsVal($NAME,"data_channel_2_min_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq { WLanThermo/MINIV3/set/channels {"number":2,"name":"Probe 2","typ":0,"temp":24.50,"min":$temp.00,"max":$EVTPART1.00,"alarm":$alarm,"color":"#22B14C"}};; }\
C3Min { my $temp=ReadingsVal($NAME,"data_channel_3_max_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq {WLanThermo/MINIV3/set/channels {"number":3,"name":"Probe 3","typ":0,"temp":24.50,"min":$EVTPART1.00,"max":$temp.00,"alarm":$alarm,"color":"#EF562D"}};; }\
C3Max { my $temp=ReadingsVal($NAME,"data_channel_3_min_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq { WLanThermo/MINIV3/set/channels {"number":3,"name":"Probe 3","typ":0,"temp":24.50,"min":$temp.00,"max":$EVTPART1.00,"alarm":$alarm,"color":"#EF562D"}};; }\
C4Min { my $temp=ReadingsVal($NAME,"data_channel_4_max_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq {WLanThermo/MINIV3/set/channels {"number":4,"name":"Probe 4","typ":0,"temp":24.50,"min":$EVTPART1.00,"max":$temp.00,"alarm":$alarm,"color":"#FFC100"}};; }\
C4Max { my $temp=ReadingsVal($NAME,"data_channel_4_min_request","---");; my $alarm=ReadingsVal($NAME,"data_channel_1_alarm","---");; return qq { WLanThermo/MINIV3/set/channels {"number":4,"name":"Probe 4","typ":0,"temp":24.50,"min":$temp.00,"max":$EVTPART1.00,"alarm":$alarm,"color":"#FFC100"}};; }\
data_channel_1_min_request {fhem("set $NAME C1Min $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_1_max_request {fhem("set $NAME C1Max $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_2_min_request {fhem("set $NAME C2Min $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_2_max_request {fhem("set $NAME C2Max $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_3_min_request {fhem("set $NAME C3Min $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_3_max_request {fhem("set $NAME C3Max $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_4_min_request {fhem("set $NAME C4Min $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_channel_4_max_request {fhem("set $NAME C4Max $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}\
data_pitmaster_pm_1_set_request {fhem("set $NAME P1Set $EVTPART1");;qq(WLanThermo/MINIV3/get/data)}
attr WlanThermo userReadings data_channel_1_min_request {sprintf('%d',ReadingsVal($name, "data_channel_1_min", "---"))},\
data_channel_1_max_request {sprintf('%d',ReadingsVal($name, "data_channel_1_max", "---"))},\
data_channel_1_alarm_request {sprintf('%d',ReadingsVal($name, "data_channel_1_alarm", "---"))},\
data_channel_2_min_request {sprintf('%d',ReadingsVal($name, "data_channel_2_min", "---"))},\
data_channel_2_max_request {sprintf('%d',ReadingsVal($name, "data_channel_2_max", "---"))},\
data_channel_2_alarm_request {sprintf('%d',ReadingsVal($name, "data_channel_2_alarm", "---"))},\
data_channel_3_min_request {sprintf('%d',ReadingsVal($name, "data_channel_3_min", "---"))},\
data_channel_3_max_request {sprintf('%d',ReadingsVal($name, "data_channel_3_max", "---"))},\
data_channel_3_alarm_request {sprintf('%d',ReadingsVal($name, "data_channel_3_alarm", "---"))},\
data_channel_4_min_request {sprintf('%d',ReadingsVal($name, "data_channel_4_min", "---"))},\
data_channel_4_max_request {sprintf('%d',ReadingsVal($name, "data_channel_4_max", "---"))},\
data_channel_4_alarm_request {sprintf('%d',ReadingsVal($name, "data_channel_4_alarm", "---"))},\
data_pitmaster_pm_1_set_request {sprintf('%d',ReadingsVal($name, "data_pitmaster_pm_1_set", "---"))}\
 

Stephan.Braun

New member
und auch noch eine ReadingsGroup (in Arbeit)

define rg_Grill readingsGroup <Name>,<Temp>,<Max/Min>,<is>,<set> WlanThermo:<Probe1>,data_channel_1_temp,<Max>,data_channel_1_max_request,data_channel_1_max WlanThermo:<>,<>,<Min>,data_channel_1_min_request,data_channel_1_min WlanThermo:<Probe2>,data_channel_2_temp,<Max>,data_channel_2_max_request,data_channel_2_max WlanThermo:<>,<>,<Min>,data_channel_2_min_request,data_channel_2_min WlanThermo:<Probe3>,data_channel_3_temp,<Max>,data_channel_3_max_request,data_channel_3_max WlanThermo:<>,<>,<Min>,data_channel_3_min_request,data_channel_3_min WlanThermo:<Pit>,data_channel_4_temp,<Max>,data_channel_4_max_request,data_channel_4_max WlanThermo:<>,<>,<Min>,data_channel_4_min_request,data_channel_4_min WlanThermo:<>,<>,<Set>,data_pitmaster_pm_1_set_request,data_pitmaster_pm_1_set WlanThermo:<Batt>,data_system_soc,<charge>,data_system_charge
setuuid rg_Grill 6583f7c0-f33f-7b81-ee8c-e742eabcfcfc1206
attr rg_Grill alias Kamado
attr rg_Grill commands { 'data_channel_1_min' => 'data_channel_1_min_request:50,52,54,55,56,57,58,59,60,75,80,85,94,96,100', 'data_channel_1_max' => 'data_channel_1_max_request:50,52,54,55,56,57,58,59,60,75,80,85,94,96,100', 'WlanThermo.data_pitmaster_pm_1_set' => 'data_pitmaster_pm_1_set_request:80,90,100'}
attr rg_Grill nonames 1
attr rg_Grill notime 1
attr rg_Grill room Grill
attr rg_Grill valueFormat { 'data_channel_1_min_request' => "%d &deg;;C", 'data_channel_1_max_request' => "%0.1f &deg;;C", 'data_channel_2_min_request' => "%0.1f &deg;;C", 'data_channel_2_max_request' => "%0.1f &deg;;C", 'data_channel_3_min_request' => "%0.1f &deg;;C", 'data_channel_3_max_request' => "%0.1f &deg;;C", 'data_channel_4_min_request' => "%d &deg;;C", 'data_channel_4_max_request' => "%d&deg;;C",'data_pitmaster_pm_1_set_request' => "%d &deg;;C", 'data_system_soc' => "%d %" }
 
Oben Unten