esphome / esphome/feature-requests
esp32 can dbc based sensor config
- Dominant language
- No language data
- Stars
- 450
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the problem you have/What new integration you would like**
With the [canbus component](https://esphome.io/components/canbus.html) can messages can be read. In the doc there is no information, how to handles several signals within a message.
Usually the messages and signals (incl types and scaling) are defined in a dbc file
Using https://pypi.org/project/cantools/ these files could be opened and used to get the message id and the correct scaling for code generation.
proposal for yaml for e.g [Tesla dbc](https://github.com/commaai/opendbc/blob/master/tesla_can.dbc)
```
# Example configuration entry
canbus:
- platform: esp32_can
tx_pin: GPIO1
rx_pin: GPIO3
bit_rate: 500kbps
- name: tesla_speed
friendly_name: "Tesla Vehicle Speed"
can_message: DI_torque2 # BO_ 280 DI_torque2: 6 DI
can_signal: DI_vehicleSpeed # SG_ DI_vehicleSpeed : 16|12@1+ (0.05,-25) [-25|179.75] "MPH" NEO
# maybe add here a lambda to change to kph
- name: tesla_temp_insd
friendly_name: "Tesla Air Temperature Insid"
can_message: BODY_R1
can_signal: AirTemp_Insd # SG_ AirTemp_Insd : 47|8@0+ (0.25,0) [0|63.5] "C" NEO
measurement_unit: "°C" # change unit
```
for different vehicles dbcs are already available - see
https://github.com/commaai/opendbc
The idea is to provide the dbc and use directly the signal name in the esphome yaml config (no problems with ids and scaling)
For code generation https://github.com/howerj/dbcc
could be considered.
**Please describe your use case for this integration and alternatives you've tried:**
The usecase would be to have a esphome directly connected via the vehicle OBD interface. As soon the vehicle connects to the wifi at home the vehicle states and precense are published to the homeassistant.
Another use case is when Home Assistant is used in a camper/ mobile home (battery state, water level, vehicle speed, position,...).
**Additional context**
related projects online:
- https://freematics.com/store/index.php?route=product/product&product_id=87
- https://www.cnx-software.com/2022/01/03/esp32-can-board-fits-into-obd-ii-dongle-supports-auto-shutdown/
- https://github.com/MagnusThome/RejsaCAN-ESP32
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.