Skip to content
Till Steinbach edited this page Jan 23, 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 devicetopic weconnect/0/vehicles/AAABBBCCCDD123456
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 $DEVICETOPIC/model:.* model\
$DEVICETOPIC/domains/access/accessStatus/overallStatus:.* accessStatus

Commands

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

Status Icon

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;;">' }