Skip to content
Till Steinbach edited this page Jan 18, 2022 · 13 revisions

Connection

With MQTT Broker:

define mymqttbroker MQTT2_CLIENT mymqttbroker:1883
attr mymqttbroker clientId fhem
attr mymqttbroker username user

afterwards set the password

Create Device for the Car

define MyCar MQTT2_DEVICE
attr MyCar IODev mymqttbroker
attr MyCar icon car
attr MyCar room Cars

Readings

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/access/accessStatus/overallStatus:.* accessStatus\
weconnect/0/vehicles/AAABBBCCCDD123456/pictures/statusWithBadge:.* { WriteFile("www/images/carstatus.png",$EVENT);;;;}

Commands

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

Status Icon

If you want to also display the cars status add:

attr MyCar readingList weconnect/0/vehicles/AAABBBCCCDD123456/model:.* model\
weconnect/0/vehicles/AAABBBCCCDD123456/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;;">' }