mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
mqtt2.template: add owntracks, bugfix in roborock; httpmod.template: add esyoil + new HM-firmware-update template
git-svn-id: https://svn.fhem.de/fhem/trunk@21101 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
7aa8917f52
commit
0e683e4897
@ -65,6 +65,41 @@ attr DEVICE readingMaxAgeReplacementMode delete
|
||||
attr DEVICE room WHICHROOM
|
||||
attr DEVICE model clever_tanken_multi_station
|
||||
|
||||
#Contributed by subseven & yersinia, see https://forum.fhem.de/index.php/topic,107189.msg1017754.html#msg1017754
|
||||
name:fuel_oil_check
|
||||
filter:TYPE=HTTPMOD
|
||||
desc: checks fuel oil prices via easyoil.com<br>Define a HTTPMOD device like<br>define heizoelpreis HTTPMOD https://www.esyoil.com/preisausgabe.php?pr-unloading-points=%%ENTLADESTELLEN%%&pr-product=8&pr-payment-type=2&%%ANHAENGER%%&pr-hose-length=%%SCHLAUCHLAENGE%%&pr-app=1&pr-zip=%%PLZ%%&pr-amount=%%MENGE%%&submit= 3600 <a href="https://forum.fhem.de/index.php/topic,107189.msg1017754.html#msg1017754">Source: Forum</a>
|
||||
order:order: 100005
|
||||
par:WHICHROOM;Actual room of the device, defaults to HTTPMOD; {AttrVal("DEVICE","room","HTTPMOD" )}
|
||||
par:INTERVAL;Actual interval for updating, defaults to hourly (3600s); {InternalVal("DEVICE","Interval",3600)}
|
||||
defmod Heizoelpreis HTTPMOD https://www.esyoil.com/preisausgabe.php?pr-unloading-points=%%ENTLADESTELLEN%%&pr-product=8&pr-payment-type=2&%%ANHAENGER%%&pr-hose-length=%%SCHLAUCHLAENGE%%&pr-app=1&pr-zip=%%PLZ%%&pr-amount=%%MENGE%%&submit= INTERVAL
|
||||
attr DEVICE userattr reading010Name reading010OExpr reading010Regex replacement01Mode:reading,internal,text,expression,key replacement01Regex replacement01Value replacement02Mode:reading,internal,text,expression,key replacement02Regex replacement02Value replacement03Mode:reading,internal,text,expression,key replacement03Regex replacement03Value replacement04Mode:reading,internal,text,expression,key replacement04Regex replacement04Value replacement05Mode:reading,internal,text,expression,key replacement05Regex replacement05Value
|
||||
attr DEVICE enableControlSet 1
|
||||
attr DEVICE reading010Name Heizoelpreis
|
||||
attr DEVICE reading010OExpr $val =~ s/,/\./;; $val;;
|
||||
attr DEVICE reading010Regex <span class="fw_b ">([\d\,]+)
|
||||
attr DEVICE replacement01Mode text
|
||||
attr DEVICE replacement01Regex %%PLZ%%
|
||||
attr DEVICE replacement01Value 40764
|
||||
attr DEVICE replacement02Mode text
|
||||
attr DEVICE replacement02Regex %%MENGE%%
|
||||
attr DEVICE replacement02Value 3000
|
||||
attr DEVICE replacement03Mode text
|
||||
attr DEVICE replacement03Regex %%ENTLADESTELLEN%%
|
||||
attr DEVICE replacement03Value 1
|
||||
attr DEVICE replacement04Mode text
|
||||
attr DEVICE replacement04Regex %%SCHLAUCHLAENGE%%
|
||||
attr DEVICE replacement04Value 40
|
||||
attr DEVICE replacement05Mode text
|
||||
attr DEVICE replacement05Regex %%ANHAENGER%%
|
||||
attr DEVICE replacement05Value pr-truck-type=short_vehicle
|
||||
attr DEVICE room WHICHROOM
|
||||
attr DEVICE stateFormat {"<div>".ReadingsTimestamp($name,"Heizoelpreis","-")." \
|
||||
<b>".ReadingsVal($name,"Heizoelpreis","-")."€;</b>/100l</div>"}
|
||||
attr DEVICE webCmd reread
|
||||
attr DEVICE model fuel_oil_check
|
||||
|
||||
|
||||
#German weather warnings from DWD, Forum: https://forum.fhem.de/index.php/topic,45176.msg905879.html#msg905879
|
||||
name:DWD_weather_warnings
|
||||
filter:TYPE=HTTPMOD
|
||||
@ -569,6 +604,101 @@ attr DEVICE userReadings newFwForDevices:MATCHED_READINGS.* {\
|
||||
attr DEVICE webCmd reread
|
||||
attr DEVICE model CUL_HM_firmware_update_downloader
|
||||
|
||||
|
||||
#Contributed by Pfriemler & yersinia, see https://forum.fhem.de/index.php/topic,78501.msg1019327.html#msg1019327
|
||||
name:hm_fw_check_v2
|
||||
filter:TYPE=HTTPMOD
|
||||
desc: check for homematic firmware updates; based on new link provided by Pfriemler (switch from eq-3.de to update.homematic.com)<br>Define a HTTPMOD device like <br>define hm_fw_check HTTPMOD https://update.homematic.com/firmware/api/firmware/search/DEVICE 86400<a href="https://forum.fhem.de/index.php/topic,78501.msg1019327.html#msg1019327">Source: Forum</a>
|
||||
order:X_01a1
|
||||
par:WHICHROOM;Actual room of the device, defaults to HTTPMOD; {AttrVal("DEVICE","room","HTTPMOD" )}
|
||||
par:INTERVAL;Actual interval for updating, defaults to one day (86400s); {InternalVal("DEVICE","Interval",86400)}
|
||||
defmod DEVICE HTTPMOD https://update.homematic.com/firmware/api/firmware/search/DEVICE INTERVAL
|
||||
attr DEVICE userattr reading01AutoNumLen reading01Name reading01RegOpt reading01Regex reading02AutoNumLen reading02Name reading02RegOpt reading02Regex readingMaxAge readingMaxAgeReplacementMode:text,reading,internal,expression,delete showNewFWOnly:yes,no
|
||||
attr DEVICE enableControlSet 1
|
||||
attr DEVICE icon hm_ccu
|
||||
attr DEVICE reading01AutoNumLen 2
|
||||
attr DEVICE reading01Name hmfw-type
|
||||
attr DEVICE reading01RegOpt g
|
||||
attr DEVICE reading01Regex (?i)"type":"((?:\w+[-]*){1,})
|
||||
attr DEVICE reading02AutoNumLen 2
|
||||
attr DEVICE reading02Name hmfw-version
|
||||
attr DEVICE reading02RegOpt g
|
||||
attr DEVICE reading02Regex (?si)"version":"(\d+[.]\d+[.]\d+)
|
||||
attr DEVICE readingMaxAge 10
|
||||
attr DEVICE readingMaxAgeReplacementMode delete
|
||||
attr DEVICE room WHICHROOM
|
||||
attr DEVICE showError 1
|
||||
attr DEVICE showMatched 1
|
||||
attr DEVICE showNewFWOnly yes
|
||||
attr DEVICE stateFormat { my $ret ="";;;;\
|
||||
my $lastCheck = ReadingsTimestamp($name,"MATCHED_READINGS","???");;;;\
|
||||
$ret .= '<div style="text-align:left">';;;;\
|
||||
$ret .= 'last <a title="eq3-downloads" href="http://www.eq-3.de/service/downloads.html">homematic</a>-fw-check => '.$lastCheck;;;;\
|
||||
$ret .= '<br><br><pre>';;;;\
|
||||
$ret .= "| device | model | cur_fw | new_fw |<br>";;;;\
|
||||
$ret .= "------------------------------------------------------------------------------<br>";;;;\
|
||||
my $check = ReadingsVal($name,"newFwForDevices","error => no or wrong data from eq3-server!");;;;\
|
||||
if($check eq "no fw-updates needed!") {\
|
||||
$ret .= '| <b style="color:green">';;;;\
|
||||
$ret .= sprintf("%-74s",$check);;;;\
|
||||
$ret .= '</b> |';;;;\
|
||||
} elsif($check eq "error => no or wrong data from eq3-server!") {\
|
||||
$ret .= '| <b style="color:red">';;;;\
|
||||
$ret .= sprintf("%-74s",$check);;;;\
|
||||
$ret .= '</b> |';;;;\
|
||||
} else {\
|
||||
my @devices = split(',',$check);;;;\
|
||||
foreach my $devStr (@devices) {\
|
||||
my ($dev,$md,$idx,$ofw,$nfw) = $devStr =~ m/([^\s]+)\s[(]([^\s]+)\s[(](\d+)[)]\sofw_([\d\.]+)\s=>\snfw_([\d\.]+)/;;;;\
|
||||
my $fw_link = "https://ccu3-update.homematic.com/firmware/download?cmd=download&serial=0&product=".$md;;;;\
|
||||
$ret .= '| <a href="/fhem?detail='.$dev.'" target="_blank"><b>';;;;\
|
||||
$ret .= sprintf("%-30s",$dev);;;;\
|
||||
$ret .= '</b></a> | ';;;;\
|
||||
$ret .= '<b'.(($md eq "?")?' title="missing attribute model => set device in teach mode to receive missing data" style="color:yellow;;"':' style="color:lightgray;;"').'>';;;;\
|
||||
$ret .= sprintf("%-23s",$md);;;;\
|
||||
$ret .= '</b> | ';;;;\
|
||||
$ret .= '<b'.(($ofw eq "0.0")?' title="missing attribute firmware => set device in teach mode to receive missing data" style="color:yellow"':' style="color:lightgray;;"').'>';;;;\
|
||||
$ret .= sprintf("%6s",$ofw);;;;\
|
||||
$ret .= '</b> | ';;;;\
|
||||
$ret .= '<a title="download firmware file" href="'.$fw_link.'" target="_blank"><b style="color:red;;">';;;;\
|
||||
$ret .= sprintf("%6s",$nfw);;;;\
|
||||
$ret .= '</b></a> | ';;;;\
|
||||
$ret .= "<br />";;;;\
|
||||
}\
|
||||
}\
|
||||
$ret .= '</pre></div>';;;;\
|
||||
return $ret;;;;\
|
||||
}
|
||||
attr DEVICE userReadings newFwForDevices:MATCHED_READINGS.* {\
|
||||
my $ret = "";;;;\
|
||||
my $newfwonly = AttrVal($name,"showNewFWOnly","yes");;;;\
|
||||
if (ReadingsVal($name,"UNMATCHED_READINGS","?") eq "") {\
|
||||
my @eq3FwList = map { \
|
||||
sprintf(ReadingsVal($name,"hmfw-type-".$_,"?").":".ReadingsVal($name,"hmfw-version-".$_,"?").":".$_);;;;\
|
||||
} ReadingsVal($name,"MATCHED_READINGS","?")=~ m/hmfw-version-(\d\d)/g;;;;\
|
||||
\
|
||||
foreach my $dev (devspec2array("TYPE=CUL_HM:FILTER=DEF=......:FILTER=subType!=(virtual|)")) {\
|
||||
my $md = AttrVal($dev,"model","?");;;;\
|
||||
my $v = AttrVal($dev,"firmware","0.0");;;;\
|
||||
my ($h,$l) = split('\.',$v);;;;\
|
||||
foreach my $newFW (grep m/^${md}:/i,@eq3FwList) {\
|
||||
my ($fwmd, $fwv, $idx) = $newFW =~ m/([^:]+):(\d+[.]\d+[.]\d+):(\d+)$/;;;;\
|
||||
my ($fwh, $fwl) = split('\.',$fwv);;;;\
|
||||
if(($newfwonly eq "no") || (($fwh > $h) || (($fwh == $h) && ($fwl > $l)))) {\
|
||||
$ret .= "," if($ret ne "");;;;\
|
||||
$ret .= $dev." (".$md." (".$idx.") ofw_".$v." => nfw_".$fwv.")";;;;\
|
||||
}\
|
||||
}\
|
||||
}\
|
||||
} else {\
|
||||
$ret = "error => no or wrong data from eq3-server!";;;;\
|
||||
}\
|
||||
return ($ret eq "")?"no fw-updates needed!":$ret;;;;\
|
||||
}
|
||||
attr DEVICE webCmd reread
|
||||
attr DEVICE model hm_fw_check_v2
|
||||
|
||||
|
||||
#Contributed by OdfFHEM, see https://forum.fhem.de/index.php/topic,97694.msg992348.html#msg992348
|
||||
name:tasmota_firmware_updates
|
||||
filter:TYPE=HTTPMOD
|
||||
|
@ -36,7 +36,8 @@ attr DEVCID bridgeRegexp \
|
||||
[^/]+[/](ems-esp[^/]+)[/].*:.* "$1"\
|
||||
wallpanel[/]([^/]+)[/].*:.* "$1"\
|
||||
(wled)[/]([^/]+)[/].*:.* "$1_$2"\
|
||||
(go-eCharger)[/]([^/]+)[/].*:.* "go_eCharger_$2"
|
||||
(go-eCharger)[/]([^/]+)[/].*:.* "go_eCharger_$2"\
|
||||
(owntracks)[/]([^/:]+)[/]([^/:]+).*:.* "$1_$2$3"
|
||||
attr DEVCID autocreate 1
|
||||
attr DEVCID comment Do not use very open bridgeRegexp expressions! This might lead to irritating results...
|
||||
attr DEVCID room NEWDEVROOM
|
||||
@ -2161,6 +2162,8 @@ attr DEVICE setList irsend:textField BASE_ID/DEVNAME/IRtoMQTT {"value":$EVTPART2
|
||||
attr DEVCID comment irsend needs Infos about protocol and value (n decimal), so e.g."IR_NEC 1587664935" should be fine...
|
||||
attr DEVICE model OpenMQTTGateway_ir
|
||||
|
||||
|
||||
|
||||
name:OpenMQTTGateway_BT_temp_hum_sensor
|
||||
prereq:{my @devices=devspec2array("model=OpenMQTTGateway_MCU");;return 1 if $devices[0];;return 0}
|
||||
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*OpenMQTTGateway.*
|
||||
@ -2181,6 +2184,50 @@ attr OMG_BT_ID jsonMap batt:batteryPercent tem:temperature hum:humidity serviced
|
||||
attr OMG_BT_ID stateFormat T: temperature°C, H: humidity%rH
|
||||
attr OMG_BT_ID model OpenMQTTGateway_BT_temp_hum_sensor
|
||||
|
||||
|
||||
|
||||
###############
|
||||
#OwnTracks
|
||||
# an OwnTracks device
|
||||
#contributed by Loredo
|
||||
#source post: https://forum.fhem.de/index.php/topic,94495.msg1020111.html#msg1020111
|
||||
name:owntracks_device
|
||||
desc:A device tracked by OwnTracks
|
||||
filter:TYPE=MQTT2_DEVICE:FILTER=CID=owntracks.*
|
||||
order:O_01
|
||||
par:TRACKER_ID;TrackerID;{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+[/]([^/:]+).*:, ? $1 : undef }
|
||||
par:DEV_ID;DeviceID;{ AttrVal("DEVICE","readingList","") =~ m,[^/:]+[/][^/:]+[/]([^/:]+).*:, ? $1 : undef }
|
||||
par:WHICHROOM;Actual room of the device, defaults to OwnTracks; {AttrVal("DEVICE","room","OwnTracks" )}
|
||||
attr DEVICE room WHICHROOM
|
||||
attr DEVICE icon location_sign
|
||||
attr DEVICE jsonMap\
|
||||
_type:lastUpdateType acc:accuracy alt:altitude batt:batteryPercent bs:batteryState cog:direction conn:connection lat:latitude lon:longitude rad:radius\
|
||||
p:pressure t:trigger tid:trackerId tst:timestamp vac:accuracyVertical vel:velocity\
|
||||
event__type:lastUpdateType event_acc:event_accuracy event_lat:event_latitude event_lon:event_longitude event_t:event_trigger event_tid:event_trackerId event_tst:event_timestamp event_wtst:event_waypointCreationTimestamp\
|
||||
step__type:lastUpdateType step_steps:steps_count step_from:steps_timestampBegin step_to:steps_timestampEnd step_tst:steps_timestampReq\
|
||||
beacon__type:lastUpdateType beacon_acc:beacon_accuracy beacon_prox:beacon_proximity beacon_tst:beacon_timestampReq\
|
||||
waypoints__type:lastUpdateType waypoints__creator:waypoints_creator\
|
||||
config__type:lastUpdateType
|
||||
attr DEVICE readingList\
|
||||
owntracks/TRACKER_ID/DEV_ID:.* { json2nameValue($EVENT,'',$JSONMAP) }\
|
||||
owntracks/TRACKER_ID/DEV_ID/event:.* { json2nameValue($EVENT,'event_',$JSONMAP) }\
|
||||
owntracks/TRACKER_ID/DEV_ID/step:.* { json2nameValue($EVENT,'step_',$JSONMAP) }\
|
||||
owntracks/TRACKER_ID/DEV_ID/beacon:.* { json2nameValue($EVENT,'beacon_',$JSONMAP) }\
|
||||
owntracks/TRACKER_ID/DEV_ID/waypoints:.* { json2nameValue($EVENT,'waypoints_',$JSONMAP) }\
|
||||
owntracks/TRACKER_ID/DEV_ID/dump:.* { json2nameValue($EVENT,'config_',$JSONMAP) }
|
||||
attr DEVICE getList\
|
||||
location:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"reportLocation"}\
|
||||
steps:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"reportSteps"}\
|
||||
config:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"dump"}\
|
||||
waypoints:noArg raw owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"waypoints"}
|
||||
attr DEVICE setList\
|
||||
config owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"setConfiguration","configuration":$EVTPART1}\
|
||||
waypoints owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"setWaypoints","waypoints":{"_type":"waypoints","waypoints":$EVTPART1}\
|
||||
action owntracks/TRACKER_ID/DEV_ID/cmd {"_type":"cmd","action":"action",$EVTPART1}
|
||||
deletereading -q DEVICE (?!associatedWith).*
|
||||
attr DEVICE model owntracks_device
|
||||
|
||||
|
||||
name:roborock
|
||||
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*valetudo[/].*
|
||||
desc:use this to control a rooted Xiamoni Vacuum / Roborock. For further details visit https://github.com/Hypfer/Valetudo<br><br>NOTE: Initial version, not yet fully tested, just build according to https://forum.fhem.de/index.php/topic,104804.0.html<br>
|
||||
@ -2207,7 +2254,7 @@ attr DEVICE setList start:noArg BASE_ID/DEVNAME/command start\
|
||||
load_map BASE_ID/DEVNAME/custom_command {"command":"load_map","name":"$EVTPART1"}\
|
||||
store_map BASE_ID/DEVNAME/custom_command {"command":"store_map","name":"$EVTPART1"}
|
||||
attr DEVICE setStateList charge locate pause stop start
|
||||
attr DEVCID comment For original code for "attrTmqtt2_roborock_valetudo2svg()" see <a href="https://forum.fhem.de/index.php/topic,104687.msg986304.html#msg986304">this forum thread</a>. To display generated map, define a weblink device: <br>define valetudo_map weblink htmlCode <img src="fhem/images/valetudo_map.svg">
|
||||
attr DEVICE comment For original code for "attrTmqtt2_roborock_valetudo2svg()" see <a href="https://forum.fhem.de/index.php/topic,104687.msg986304.html#msg986304">this forum thread</a>. To display generated map, define a weblink device: <br>define valetudo_map weblink htmlCode <img src="fhem/images/valetudo_map.svg">
|
||||
farewell:template has been applied successfully. <br>NOTE: additional code has been downloaded from svn (contrib). <br>To display generated map, define a weblink device: define valetudo_map weblink htmlCode <img src="fhem/images/valetudo_map.svg">.<br>For details, see <a href="https://forum.fhem.de/index.php/topic,104687.msg986304.html#msg986304">this forum thread</a>.
|
||||
attr DEVICE model roborock
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user