2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

mqtt2.template: add wled and go-eCharger

git-svn-id: https://svn.fhem.de/fhem/trunk@20575 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2019-11-25 07:43:44 +00:00
parent 1e42622617
commit 545b3c9bc6
2 changed files with 52 additions and 6 deletions

View File

@ -727,13 +727,13 @@ filter:TYPE=HTTPMOD
desc: Show updates for <a href="https://dnscrypt.info/">DNSCRYPT.</a><br>Define a HTTPMOD device like <br>defmod dnscrypt_proxy_version HTTPMOD https://api.github.com/repos/jedisct1/dnscrypt-proxy/releases/latest 86400<br><a href="https://forum.fhem.de/index.php/topic,97694.msg992002.html#msg992002">Source: Forum</a>
order:X_01x
par:WHICHROOM;Actual room of the device, defaults to HTTPMOD; {AttrVal("DEVICE","room","HTTPMOD" )}
attr DEVICE userattr userattr pihole_version
attr DEVICE userattr userattr myInstalledVersion
attr DEVICE extractAllJSON 1
attr DEVICE extractAllJSONFilter tag_name
attr DEVICE stateFormat {"<p align=\"left\">".ReadingsTimestamp($name,'tag_name','')."<br />Online: <a href=\"https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/ChangeLog\"\
title=\"ChangeLog\" rel=\"noopener noreferrer\" target=\"_blank\"><b>".ReadingsVal($name,'tag_name','')."</b></a><br />\
pihole: <b>".AttrVal($name,'pihole_version','')."</b></p>"}
attr DEVICE pihole_version 2.0.31
pihole: <b>".AttrVal($name,'myInstalledVersion','')."</b></p>"}
attr DEVICE myInstalledVersion 2.0.31
attr DEVICE room WHICHROOM
attr DEVICE enableControlSet 1
attr DEVICE model dnscrypt-proxy_updates

View File

@ -34,7 +34,9 @@ attr DEVCID bridgeRegexp \
(ESPClient_[^/]+)[/].*:.* "$1"\
valetudo[/]([^/]+)[/].*:.* "$1"\
[^/]+[/](ems-esp[^/]+)[/].*:.* "$1"\
wallpanel[/]([^/]+)[/].*:.* "$1"
wallpanel[/]([^/]+)[/].*:.* "$1"\
(wled)[/]([^/]+)[/].*::.* "$1_$2"\
(go-eCharger)[/]([^/]+)[/].*::.* "go_eCharger_$2"
attr DEVCID autocreate 1
attr DEVCID comment Do not use very open bridgeRegexp expressions! This might lead to irritating results...
attr DEVCID room NEWDEVROOM
@ -1510,7 +1512,8 @@ attr DEVICE icon ICON
attr DEVICE setList\
off:noArg shellies/DEVNAME/light/0/command off\
on:noArg shellies/DEVNAME/light/0/command on\
pct:slider,0,1,100 shellies/DEVNAME/light/0/set {"turn": "on","brightness": $EVTPART1}
pct:slider,0,1,100 shellies/DEVNAME/light/0/set {"turn": "on","brightness": $EVTPART1}\
x_mqttcom shellies/DEVNAME/command $EVTPART1
deletereading -q DEVICE status_.*
attr DEVICE readingList \
shellies/DEVNAME/light/0/status:.* {json2nameValue($EVENT)}\
@ -1781,7 +1784,7 @@ filter:TYPE=MQTT2_DEVICE
desc:use this with an OpenMQTTGateway. For further details visit https://github.com/1technophile/OpenMQTTGateway/wiki<br>Recommended structure of the topic pattern home/OpenMQTTGateway/.*.<br>NOTE: Initial version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,103737.0.html<br>Adopt
order:X_02
par:BASE_ID;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]OpenMQTTGateway[^/]*[/].*:, ? $1 : undef }
par:DEVNAME;BASE_ID typically is home;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](OpenMQTTGateway[^/]*)[/].*:, ? $2 : undef }
par:DEVNAME;DEVNAME typically contains OpenMQTTGateway;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/](OpenMQTTGateway[^/]*)[/].*:, ? $2 : undef }
par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal("DEVICE","IODev",""),"clientId","mosquitto") eq InternalVal("DEVICE","DEF","mosquitto") ? "oMQTTgw_MCU" : InternalVal("DEVICE","DEF","mosquitto")}
par:ICON;ICON as set, defaults to MQTT;{ AttrVal("DEVICE","icon","mqtt") }
deletereading -q DEVICE (?!associatedWith).*
@ -1934,3 +1937,46 @@ attr DEVICE setList alert:textField wallpanel/DEVNAME/command {"eval": "alert('$
attr DEVICE comment For further info on configuration and available commands see <a href="https://thanksmister.com/wallpanel-android/">project page</a>.
farewell:template has been applied successfully. For further info on configuration and available commands see <a href="https://thanksmister.com/wallpanel-android/">project page</a>.
attr DEVICE model wallpanel_app
#source post: https://forum.fhem.de/index.php/topic,98880.msg995308.html#msg995308
name:wled_controller
filter:TYPE=MQTT2_DEVICE
desc:To control a WLED device, see https://github.com/Aircoookie/WLED/wiki for details).
order:W_01
par:BASE_ID;BASE_ID typically is wled;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/][^/]+[/].*:, ? $1 : undef }
par:DEVNAME;Device name as configured;{ AttrVal("DEVICE","readingList","") =~ m,([^:]+)[/]([^/]+)[/].*:, ? $1 : undef }
par:ICON;ICON as set, defaults to hue_filled_iris;{ AttrVal("DEVICE","icon","hue_filled_iris") }
attr DEVICE icon ICON
attr DEVICE setList\
on:noArg BASE_ID/DEVNAME status on\
off:noArg BASE_ID/DEVNAME status off\
toggle:noArg BASE_ID/DEVNAME status t\
rgb:colorpicker,RGB BASE_ID/DEVNAME/col #$EVTPART1\
brightness:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME
attr DEVICE readingList \
BASE_ID/DEVNAME/g:.* brightness\
BASE_ID/DEVNAME/c:.* {{"rgb"=>substr("$EVENT",1,6)}}\
BASE_ID/DEVNAME/v:.* api
deletereading -q DEVICE (?!associatedWith).*
attr DEVICE devStateIcon {Color::devStateIcon( $name, "rgb", "rgb", "brightness", "state" )}
attr DEVICE webCmd rgb:brightness
attr DEVICE model wled_controller
#source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924
name:go_eCharger
filter:TYPE=MQTT2_DEVICE
desc:See source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924 for details. For complete MQTT-API see https://go-e.co/app/api.pdf
order:W_02
par:BASE_ID;BASE_ID typically is go-eCharger;{ AttrVal("DEVICE","readingList","") =~ m,(go-eCharger)[/][^/]+[/].*:, ? $1 : undef }
par:SERIAL;Serial number;{ AttrVal("DEVICE","readingList","") =~ m,go-eCharger[/]([^/]+)[/].*:, ? $1 : undef }
par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","mqtt") }
attr DEVICE icon ICON
attr DEVICE event-on-change-reading .*
attr DEVICE readingList BASE_ID/SERIAL/status:.* { json2nameValue($EVENT) }\
BASE_ID/SERIAL/ip:.* { json2nameValue($EVENT) }
attr DEVICE setList Charge_ON:noArg BASE_ID/SERIAL/cmd/req alw=1\
Charge_OFF:noArg BASE_ID/SERIAL/cmd/req alw=0\
amp:selectnumbers,1,1,22,1,lin go-eCharger/SERIAL/cmd/req amp=$EVTPART1
attr DEVICE stateFormat Status: charger_state P_akt: energy_akt V1: nrg_1 V2: nrg_2 V3: nrg_3
attr DEVICE userReadings charger_state:car.* { my $val = ReadingsVal($name,"car","none");; my %rets = ("none" => "-1","1" => "Ready","2" => "Charging","3" => "waiting for car","4" => "Charging finished");; $rets{$val}}, temperature:temp.* { ReadingsVal($name,"tmp",0) }, energy_total:eto.* { ReadingsVal($name,"eto",0)*0.1 }, energy_akt:dws.* { ReadingsVal($name,"dws",0)*2.77 }
attr DEVICE model go_eCharger