Integrating your vehicle’s On-Board Diagnostics (OBD2) data into your smart home system opens up a world of possibilities for automation and monitoring. With open source tools like WiCAN and Home Assistant, you can gain unprecedented access to your car’s performance and health metrics. This guide will walk you through setting up WiCAN to seamlessly send CAN bus messages to Home Assistant, leveraging the power of MQTT and Node-RED for a truly open and customizable OBD2 experience.
To begin, ensure you have the following prerequisites in place within your Home Assistant setup. First, install the Mosquitto broker add-on. This MQTT broker will act as the communication bridge between WiCAN and Home Assistant. Next, for enhanced automation capabilities, install the Node-RED Add-on. Node-RED’s visual flow-based programming makes it easy to create automations based on the CAN messages received from your vehicle. Finally, create a dedicated Home Assistant user account specifically for WiCAN. These credentials will be used to configure the MQTT settings on your WiCAN device, ensuring secure communication.
Now, let’s configure your WiCAN device. Connect to the WiCAN access point, typically named WiCAN_xxxxxxxxxxxx
. Once connected, open a web browser and navigate to http://192.168.80.1/
. Within the WiCAN web interface, set the “Mode” to “Ap+Station”. This allows WiCAN to act as both an access point and a station, connecting to both your local WiFi network and providing a direct access point for initial configuration. Enter your home WiFi network’s SSID and password to connect WiCAN to your network.
The crucial step for Home Assistant integration is enabling MQTT on WiCAN. Locate the MQTT settings within the WiCAN web interface, enable MQTT, and input the Home Assistant user credentials you created earlier. These credentials will authenticate WiCAN with your MQTT broker.
With the MQTT bridge established, the next step involves Node-RED. Download the example Node-RED flow configuration file, wican_example_flow.json
, from the WiCAN GitHub repository. Before importing, remember to replace the placeholder device_id
within the wican_example_flow.json
file with your specific WiCAN device ID. Access the Node-RED Add-on in Home Assistant and import the edited wican_example_flow.json
file. Double-click the “subscription” Node within the imported flow. Configure the server settings by entering your MQTT broker’s IP address (typically your Home Assistant IP address) and the same Home Assistant user credentials used for WiCAN MQTT setup. Click “deploy” in Node-RED to activate the flow.
WiCAN device sending CAN bus data to Home Assistant via MQTT and visualized in Node-RED for open source OBD2 integration
To visualize your OBD2 data in Home Assistant, you need to define MQTT sensors. Edit your configuration.yaml
file and add MQTT sensor definitions. For example, to monitor ambient temperature and fuel level, add the following lines:
mqtt:
sensor:
- name: "Amb Temp"
state_topic: "CAR1/Amb_Temp"
unit_of_measurement: "C"
value_template: "{{ value_json.amb_temp }}"
- name: "Fuel Level"
state_topic: "CAR1/Fuel_Level"
unit_of_measurement: "%"
value_template: "{{ value_json.fuel_level }}"
Remember to adjust the state_topic
values (e.g., “CAR1/Amb_Temp”) to match the topics being published by your WiCAN device. After editing configuration.yaml
, restart Home Assistant for the changes to take effect. Once restarted, you can add new “Entity” cards to your Home Assistant dashboard to display the newly created MQTT sensors, bringing your Open Source Obd2 data to life within your smart home environment. This open approach empowers you to monitor, log, and automate based on your vehicle’s data, all within your personal smart home ecosystem.