-
-
Notifications
You must be signed in to change notification settings - Fork 12
FHEM examples
Till Steinbach edited this page Jan 20, 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 icon car
attr MyCar room Cars
Now map the topics you want to use to the MQTT topics: e.g.:
attr MyCar readingList weconnect/0/vehicles/AAABBBCCCDD123456/model:.* model\
weconnect/0/vehicles/AAABBBCCCDD123456/domains/access/accessStatus/overallStatus:.* accessStatus
To use commands, you have to map those to writeable topics:
attr MyCar setList climatisation:start,stop weconnect/0/vehicles/AAABBBCCCDD123456/controls/climatisation $EVTPART1\
charging:start,stop weconnect/0/vehicles/AAABBBCCCDD123456/controls/charging $EVTPART1
If you want to also display the cars status add:
attr MyCar readingList weconnect/0/vehicles/AAABBBCCCDD123456/model:.* model\
weconnect/0/vehicles/AAABBBCCCDD123456/domains/access/accessStatus/overallStatus:.* accessStatus\
weconnect/0/vehicles/AAABBBCCCDD123456/pictures/statusWithBadge:.* { WriteFile("www/images/carstatus.png",$EVENT);;;;}
attr MyCar devStateIcon { '<img src="fhem/images/carstatus.png" style="max-width:256px;; max-height:256px;;">' }