2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

mqtt2.template: small changes; httpmod.template: initial version

git-svn-id: https://svn.fhem.de/fhem/trunk@18079 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2018-12-28 14:30:00 +00:00
parent d31c246a32
commit 9c5224bedf
2 changed files with 142 additions and 18 deletions

View File

@ -0,0 +1,116 @@
#$id$
#################################
#Clever Tanken
#
#Single station prices, Forum: https://forum.fhem.de/index.php/topic,94640.msg873905.html#msg873905
name:A_01a_clever_tanken_single_station
filter:TYPE=HTTPMOD
desc: Get prices for a single gas station.<br>Define a HTTPMOD device like <br>defmod DEVICE HTTPMOD http://www.clever-tanken.de/tankstelle_details/29092 1800 <br>Change station ID to your needs <br><a href="https://forum.fhem.de/index.php/topic,94640.msg873905.html#msg873905">Source: Forum</a>
attr DEVICE userattr reading01Name reading01Regex reading02Name reading02Regex reading03Name reading03Regex readingOExpr
attr DEVICE enableControlSet 1
attr DEVICE reading01Name Diesel
attr DEVICE reading01Regex SpritsortenController[^0-9]+([0-9,]+)[^0-9]+Diesel
attr DEVICE reading02Name SuperE10
attr DEVICE reading02Regex SpritsortenController[^0-9]+([0-9,]+)[^0-9]+Super E10
attr DEVICE reading03Name SuperE5
attr DEVICE reading03Regex SpritsortenController[^0-9]+([0-9,]+)[^0-9]+Super E5
attr DEVICE readingOExpr $val =~ tr/,/./;;$val
attr DEVICE room 2_6_Spritpreise
attr DEVICE stateFormat E5: SuperE5 € / E10: SuperE10 € / D: Diesel €
attr DEVICE timeout 10
attr DEVICE verbose 2
attr DEVICE model A_01a_clever_tanken_single_station
#defmod FileLogSpritE5 FileLog ./log/SpritE5-%Y.log TankeJetRueckmarsdorfer:SuperE5:.*|DEVICE:SuperE5:.*
#Station overview, one product, Forum: https://forum.fhem.de/index.php/topic,94640.msg873841.html#msg873841
name:A_01a_clever_tanken_multi_station
filter:TYPE=HTTPMOD
desc: Get prices for one product as environment search.<br>Define a HTTPMOD device like <br>defmod DEVICE HTTPMOD https://www.clever-tanken.de/tankstelle_liste?spritsorte=3&r=10&ort=52152 1800 <br>Change PLZ, radius and product to your needs <br><a href="https://forum.fhem.de/index.php/topic,94640.msg873841.html#msg873841">Source: Forum</a>
attr DEVICE reading01Name Tankstellenname
attr DEVICE reading01Regex <div class=\"row fuel-station-location-name\">(.*)<\/div>
attr DEVICE reading01RegOpt g
attr DEVICE reading02Name Preis ;
attr DEVICE reading02Regex <div class=\"price\">(.*)<sup>
attr DEVICE reading02RegOpt g
attr DEVICE reading03Name Strasse ;
attr DEVICE reading03Regex <div id=\"fuel-station-location-street\">(.*)<\/div>
attr DEVICE reading03RegOpt g
attr DEVICE reading04Name Ort
attr DEVICE reading04Regex <div id=\"fuel-station-location-city\"> (.*)<\/div>
attr DEVICE reading04RegOpt g
attr DEVICE reading05Name Entfernung
attr DEVICE reading05Regex <div >(.*)<\/div>
attr DEVICE reading05RegOpt g
attr DEVICE model A_01a_clever_tanken_multi_station
#Austrian weather, Forum: https://forum.fhem.de/index.php/topic,94110.msg868080.html#msg868080
name:A_02m_ORF_weather
filter:TYPE=HTTPMOD
desc: Get austrian weather.<br>Define a HTTPMOD device like <br>defmod DEVICE HTTPMOD defmod weatherORF HTTPMOD https://wetter.orf.at/wien/ 1800 <br>Change city to your needs <br><a href="https://forum.fhem.de/index.php/topic,94110.msg868080.html#msg868080">Source: Forum</a>
attr DEVICE userattr reading01-1Name reading01-2Name reading01-3Name reading01-4Name reading01-5Name reading01Regex reading02-1Name reading02-2Name reading02-3Name reading02-4Name reading02-5Name reading02-6Name reading02-7Name reading02-8Name reading02Regex
attr DEVICE enableControlSet 1
attr DEVICE reading01-1Name temperature
attr DEVICE reading01-2Name weather
attr DEVICE reading01-3Name wind
attr DEVICE reading01-4Name windDir
attr DEVICE reading01-5Name precipitation
attr DEVICE reading01Regex Innere Stadt<\/h3>[\s\S]*temperature\">(\d*,?\d?)[\s\S]*screen\">, ([\s\S]*)\.<\/span>[\s\S]*wind\">(\d*,?\d?)[\s\S]*screen\">,.([\s\S]*)\.[\s\S]*precipitation\">(\d*,?\d+)
attr DEVICE reading02-1Name sunRise
attr DEVICE reading02-2Name sunSet
attr DEVICE reading02-3Name moonPhase
attr DEVICE reading02-4Name moonRise
attr DEVICE reading02-5Name moonSet
attr DEVICE reading02-6Name dayLength
attr DEVICE reading02-7Name dawn
attr DEVICE reading02-8Name dusk
attr DEVICE reading02Regex Sonnenaufgang um <\/span>(.*)<s[\w\W]*Sonnenuntergang um <\/span>(.*)<s[\w\W]*Mondphase: (.*)\.[\w\W]*Mondaufgang um <\/span>(.*)<s[\w\W]*Monduntergang um <\/span>(.*)<s[\w\W]*Tagesl&auml;;nge: <\/span>(.*)&[\w\W]*Morgen<\/span>: <\/span>(.*)&[\w\W]*Abend:<\/span><\/span>(.*)&
attr DEVICE room Wetter
attr DEVICE stateFormat weather bei temperature°C
attr DEVICE model A_02m_ORF_weather
#homebridge-videodoorbell, Forum: https://forum.fhem.de/index.php/topic,94291.msg870289.html#msg870289
name:A_02c_homebridge_videodoorbell
filter:TYPE=HTTPMOD
desc: Controll your homebridge-videodoorbell.<br>Define a HTTPMOD device like <br>define Video_Doorbell HTTPMOD none 0 <br><a href="https://forum.fhem.de/index.php/topic,94291.msg870289.html#msg870289">Source: Forum</a>
par:IP_PORT;Enter IP:Port as configured in your doorbell, like 123.456.7.8:5005;{undef }
attr DEVICE get01Name klingel2homekitget
attr DEVICE get01URL http://IP_PORT/
attr DEVICE get01Data ding=dong&dong=ding
attr DEVICE get01Header02 User-Agent: curl/7.38.0
attr DEVICE get01Header04 Accept: */*
attr DEVICE get01Header06 Content-Type: application/x-www-form-urlencoded
attr DEVICE set01Name klingel2homekitset
attr DEVICE set01URL http://IP_PORT/
attr DEVICE set01Data ding=dong&dong=ding
attr DEVICE set01Header02 User-Agent: curl/7.38.0
attr DEVICE set01Header04 Accept: */*
attr DEVICE set01Header06 Content-Type: application/x-www-form-urlencoded
attr DEVICE set01NoArg 1
attr DEVICE model A_02c_homebridge_videodoorbell
#RESOL Solaranlage, Forum: https://forum.fhem.de/index.php/topic,86678.0.html
name:C_01a_resol_solar
filter:TYPE=HTTPMOD
desc: Get data from your RESOL solar installation<br>Define a HTTPMOD device like <br>define Solar HTTPMOD http://192.178.002.112/dl2/live/data 300 <br><a href="https://forum.fhem.de/index.php/topic,86678.0.html">Source: Forum</a>
attr DEVICE userattr reading01Name reading01Regex reading02Name reading02Regex reading03Name reading03Regex reading04Name reading04Regex reading05Name reading05Regex reading06Name reading06Regex timeout
attr DEVICE group A_Energy
attr DEVICE reading01Name Temperatur_Sensor1
attr DEVICE reading01Regex Temperatur Sensor 1:[^0-9]+([0-9\.]+)
attr DEVICE reading02Name Temperatur_Sensor2
attr DEVICE reading02Regex Temperatur Sensor 2:[^0-9]+([0-9\.]+)
attr DEVICE reading03Name Temperatur_Sensor3
attr DEVICE reading03Regex Temperatur Sensor 3[^0-9]+([0-9\.]+)
attr DEVICE reading04Name Temperatur_Sensor4
attr DEVICE reading04Regex Temperatur Sensor 4[^0-9]+([0-9\.]+)
attr DEVICE reading05Name Drehzahl_Pumpe
attr DEVICE reading05Regex Drehzahl Pumpe 1[^0-9]+([0-9\.]+)
attr DEVICE reading06Name Betriebsstunden
attr DEVICE reading06Regex Betriebsstunden Relais 1[^0-9]+([0-9\.]+)
attr DEVICE room 01 Heizungsraum
attr DEVICE stateFormat Dachtemperatur: Temperatur_Sensor1 Drehzahl Pumpe: Drehzahl_Pumpe Laufzeit Heute: Tageslaufzeit
attr DEVICE timeout 5ercent="([\d\.]+)
attr DEVICE model C_01a_resol_solar

View File

@ -144,9 +144,7 @@ attr DEVICE eventMap { dev=>{'^(.*)POWER(.?): OFF$'=>'$1POWER$2: off', '^(.*)POW
attr DEVICE setList \
off:noArg COMMAND/POWER1 0\
on:noArg COMMAND/POWER1 1\
toggle:noArg COMMAND/POWER1 2\
mqttRetry COMMAND/MqttRetry
#Forum topic 90145 msg 872776
toggle:noArg COMMAND/POWER1 2
attr DEVICE readingList \
tele/DEVNAME/LWT:.* LWT\
tele/DEVNAME/STATE:.* { json2nameValue($EVENT) }\
@ -161,7 +159,7 @@ attr DEVICE model A_01a_tasmota_basic_state_power1
# sonoff 1 channel device flashed with Tasmota.
name:A_01_tasmota_basic
filter:TYPE=MQTT2_DEVICE
desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state <br>Use this in case "SetOption26 1" was used as described in tasmota documentation
desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state
set DEVICE attrTemplate A_01a_tasmota_basic_state_power1
attr DEVICE stateFormat POWER
attr DEVICE setList \
@ -170,17 +168,21 @@ attr DEVICE setList \
toggle:noArg COMMAND/POWER 2
attr DEVICE model A_01_tasmota_basic
name:A_01x_tasmota_sensors_only
name:A_01x_tasmota_clear_readings_reset_readingsList_and_reboot
filter:TYPE=MQTT2_DEVICE
desc:Applies to all tasmota devices without relay
desc: replaces the readingList with defaults, clears the readingList and reboots to get all readings
par:COMMAND;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\btele(/.*)?/LWT:, ? "${1}cmnd$2" : undef }
par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef }
par:IO_DEV;Currently used IO;{ AttrVal("DEVICE","IODev","")}
attr DEVICE readingList \
tele/DEVNAME/LWT:.* LWT\
tele/DEVNAME/STATE:.* { json2nameValue($EVENT) }\
tele/DEVNAME/SENSOR:.* { json2nameValue($EVENT) }\
tele/DEVNAME/INFO.:.* { json2nameValue($EVENT) }\
stat/DEVNAME/RESULT:.* { json2nameValue($EVENT) }
deleteReading DEVICE .*
deletereading DEVICE .*
set IO_DEV publish COMMAND/Restart 1
attr DEVICE autocreate 0
name:A_01x_tasmota_prefix_clearing_and_reboot
filter:TYPE=MQTT2_DEVICE
@ -194,7 +196,6 @@ deletereading DEVICE .*
set IO_DEV publish COMMAND/Restart 1
attr DEVICE autocreate 0
# tasmota device with one relay, one motion sensor via switch
name:A_01b_tasmota_1ch+motion+SI7021
desc:tasmota device with one relay, one motion sensor via switch and one SI7021 combined temperature and humidity sensor. <br>Configures a single device including all readings
@ -206,6 +207,12 @@ attr DEVICE setList \
on:noArg cmnd/DEVNAME/POWER1 1\
toggle:noArg cmnd/DEVNAME/POWER1 2
attr DEVICE stateFormat {\
ReadingsVal($name, "POWER1", "off") . " "\
ReadingsVal($name, "POWER2", "off") . " "\
. sprintf("%.1f°C ",ReadingsVal($name,"SI7021_Temperature",0))\
. sprintf("%.0f%%",ReadingsVal($name,"SI7021_Humidity",0))\
}
attr DEVICE devStateIcon {\
my $state = lc ReadingsVal($name, "POWER2", "off");\
my $devStateIcon = 'building_security@green';\
if ($state eq "on") {\
@ -263,15 +270,16 @@ attr DEVICE setList \
p3:on,off,toggle cmnd/DEVNAME/POWER3 $EVTPART1\
p4:on,off,toggle cmnd/DEVNAME/POWER4 $EVTPART1
attr DEVICE devStateIcon {\
"<div><a href=\"/fhem?cmd.dummy=set ".$name." p1 toggle&XHR=1\">POWER1:"\
. FW_makeImage(lc ReadingsVal($name, "POWER1", "off"))\
. "</a> <a href=\"/fhem?cmd.dummy=set ".$name." p2 toggle&XHR=1\">POWER2:"\
. FW_makeImage(lc ReadingsVal($name, "POWER2", "off")) . "</a></div>"\
. "</a> <a href=\"/fhem?cmd.dummy=set ".$name." p3 toggle&XHR=1\">POWER3:"\
. FW_makeImage(lc ReadingsVal($name, "POWER3", "off")) . "</a></div>"\
. "</a> <a href=\"/fhem?cmd.dummy=set ".$name." p4 toggle&XHR=1\">POWER4:"\
. FW_makeImage(lc ReadingsVal($name, "POWER4", "off")) . "</a></div>"\
}
"<div><a href=\"/fhem?cmd.dummy=set ".$name." p1 toggle&XHR=1\">POWER1:"\
. FW_makeImage(lc ReadingsVal($name, "POWER1", "off"))\
. "</a> <a href=\"/fhem?cmd.dummy=set ".$name." p2 toggle&XHR=1\">POWER2:"\
. FW_makeImage(lc ReadingsVal($name, "POWER2", "off")) . "</a></div>"\
. "</a> <a href=\"/fhem?cmd.dummy=set ".$name." p3 toggle&XHR=1\">POWER3:"\
. FW_makeImage(lc ReadingsVal($name, "POWER3", "off")) . "</a></div>"\
. "</a> <a href=\"/fhem?cmd.dummy=set ".$name." p4 toggle&XHR=1\">POWER4:"\
. FW_makeImage(lc ReadingsVal($name, "POWER4", "off")) . "</a></div>"\
}
attr DEVICE stateFormat P1: POWER1 P2: POWER2 P3: POWER3 P4: POWER4
attr DEVICE webCmd :
attr DEVICE model A_04b_tasmota_4ch_unified_icon