-
-
Notifications
You must be signed in to change notification settings - Fork 12
FHEM examples
Till Steinbach edited this page Jan 23, 2022
·
13 revisions
define mymqttbroker MQTT2_CLIENT mymqttbroker:1883
attr mymqttbroker clientId fhem
attr mymqttbroker username user
afterwards set the password
define MyCar MQTT2_DEVICE
attr MyCar IODev mymqttbroker
attr MyCar devicetopic weconnect/0/vehicles/AAABBBCCCDD123456
attr MyCar icon car
attr MyCar room Cars
Now map the topics you want to use to the MQTT topics: e.g.:
attr MyCar readingList $DEVICETOPIC/model:.* model\
$DEVICETOPIC/domains/access/accessStatus/overallStatus:.* accessStatus
To use commands, you have to map those to writeable topics:
attr MyCar setList climatisation:start,stop $DEVICETOPIC/controls/climatisation $EVTPART1\
charging:start,stop $DEVICETOPIC/controls/charging $EVTPART1
If you want to also display the cars status add:
attr MyCar readingList $DEVICETOPIC/model:.* model\
$DEVICETOPIC/domains/access/accessStatus/overallStatus:.* accessStatus\
$DEVICETOPIC/pictures/statusWithBadge:.* { WriteFile("www/images/$NAME-status-badge.png",$EVENT);;;;}
attr MyCar devStateIcon { '<img src="fhem/images/' . $name . '-status-badge.png" style="max-width:256px;; max-height:256px;;">' }