Support for CAN Bus (Peak, Ixxat, canable etc)

I have no Interest in implementing Canbus directly to Homeassistant.
I prefer edge Computing!
For me the controls run as scripts in EspHome autonomously and can optionally be controlled via Homeassistant.
So we can still control the window blinds when the Server is updating, etc.

no problem, thnx for feedback! :slight_smile:

But if someone else is going to start this projects I can give some hints how Python works together with Canbus like a charm.

  1. As mentioned earlier in the thread start setting up SocketCan with an appropriate USB-Can Interface. I tested Peak, Systec, MHS Tinycan and Lawicel (SLCAN) and they all work. Peak is the only one of these which needs no daemon running or where you do not need to compile an own module.
    Peak and Systec and Lawicel also run on windows with python.
  2. Use the DBC Component of https://pypi.org/project/cantools/ - in an DBC file the Can Frames are described and mapped to Data objects. You can download CanDB++ Editor from Vector for free to generate the Definitions.
    DBC Editor
    Going this way will save you very much time on defining your data and make your project really portable to other CAN-Applications.

I which you all the success with your project.

Hi,

Sorry to not reply sooner, I am sweating over a tight deadline for work right now I’m afraid. I hope to get some free time starting next week :slight_smile:

I’m still very interested in this project, but cannot guarantee I can put much time in it right now.

Creating an extension for HA is very well documented. You can also have a look at my repository’s code to see how I did it. It is far from perfect, but it does include adding the integration through the integration page instead of manually configuring it.

I did receive my cannable.io device and some other devices I ordered to tinker with, but I didn’t even unwrap them yet…

aha, you are still alive :slight_smile:
thnx for feedback already!

Hi @OpenJeDi and thank you for your reply!

I definitely agree with you that the development documentation is very good. Nevertheless I just don’t understand what to do now :sweat_smile: . It is just a problem somewhere inside of my head…

I don’t want to stress your tough time even more. I will try to do as many things as possible by myself. But of course it is highly appreciated, if there are people willing to help me to help myself :slight_smile: .

So most testing stuff could probably be done on my side. Programming… maybe :wink: .

1 Like

so i also have a canable.io , going to attach it to my esx server and to my HassOS
Do you have some kind of test script that i can use, to actually see if the hardware is working on HassOS ? for example to read canbus messages
That way i can help too with this project :slight_smile:

i also probably need candlelight firmware? right? => https://canable.io/

https://canable.io/

hmm, i think there is something wrong with my canable, just plugged it in first time use in windows desktop pc, but windows is not recognizing hardware at all in device manager , allthough greed light is on on the canable.io … verry strange

EDIT: nm, seems to be working now with another usb cable , verry strange

ok, attached it to my HassOS, but in supervisor ‘hardware’ its not showing up … as a new hardware device
is it possible that HassOS is not able to detect it? my deconz USB stick works perfectly fine if i attach it

i see following output on hassio on raspberry 4:

  • name: 1-1.3
    sysfs: >-
    /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
    dev_path: /dev/bus/usb/001/004
    subsystem: usb
    by_id: null
    attributes:
    BUSNUM: ‘001’
    DEVNAME: /dev/bus/usb/001/004
    DEVNUM: ‘004’
    DEVPATH: >-
    /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
    DEVTYPE: usb_device
    DRIVER: usb
    ID_BUS: usb
    ID_MODEL: ‘CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw’
    ID_MODEL_ENC: >-
    CANable\x201205aa6\x20https:\x2f\x2fgithub.com\x2fnormaldotcom\x2fcantact-fw
    ID_MODEL_ID: 60c4
    ID_REVISION: ‘0200’
    ID_SERIAL: >-
    Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036
    ID_SERIAL_SHORT: 0004001E4E4E430820353036
    ID_USB_INTERFACES: ‘:020201:0a0000:’
    ID_VENDOR: Protofusion_Labs
    ID_VENDOR_ENC: Protofusion\x20Labs
    ID_VENDOR_ID: ad50
    MAJOR: ‘189’
    MINOR: ‘3’
    PRODUCT: ad50/60c4/200
    SUBSYSTEM: usb
    TYPE: 2/2/0
    USEC_INITIALIZED: ‘82643440814’
  • name: ttyACM1
    sysfs: >-
    /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM1
    dev_path: /dev/ttyACM1
    subsystem: tty
    by_id: >-
    /dev/serial/by-id/usb-Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036-if00
    attributes:
    DEVLINKS: >-
    /dev/serial/by-id/usb-Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036-if00
    /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0
    DEVNAME: /dev/ttyACM1
    DEVPATH: >-
    /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/tty/ttyACM1
    ID_BUS: usb
    ID_MODEL: ‘CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw’
    ID_MODEL_ENC: >-
    CANable\x201205aa6\x20https:\x2f\x2fgithub.com\x2fnormaldotcom\x2fcantact-fw
    ID_MODEL_ID: 60c4
    ID_PATH: ‘platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0’
    ID_PATH_TAG: platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3_1_0
    ID_REVISION: ‘0200’
    ID_SERIAL: >-
    Protofusion_Labs_CANable_1205aa6_https:__github.com_normaldotcom_cantact-fw_0004001E4E4E430820353036
    ID_SERIAL_SHORT: 0004001E4E4E430820353036
    ID_TYPE: generic
    ID_USB_DRIVER: cdc_acm
    ID_USB_INTERFACES: ‘:020201:0a0000:’
    ID_USB_INTERFACE_NUM: ‘00’
    ID_VENDOR: Protofusion_Labs
    ID_VENDOR_ENC: Protofusion\x20Labs
    ID_VENDOR_ID: ad50
    MAJOR: ‘166’
    MINOR: ‘1’
    SUBSYSTEM: tty
    USEC_INITIALIZED: ‘82643445676’

Yeah, seems as USB with default firmware, but as serial with candle light… Working now , gonna try add today to HassOS, and then mount it on HA addon…
Going to add a custom component, so the canutils and python-can modules are going to be installed automaticly

@xtra, did you already done some stuff with the canable? Or still using the mcp?

ok, i added can-utils with this command : apk add can-utils
so i can use stuff like candump and slcand in HassOs

but seems i am unable to load the can0 ttyacm0 device, because of the kernel is not loading all “can & slcand” modules …

see here : http://socket-can.996257.n3.nabble.com/Some-problems-with-CANUSB-and-Ubuntu-8-04-9-04-td1632.html

no idea is this is possible in HassOs, so i quess we need an extra add-on for HassOs users

@pergola.fabio
Hm, this is not so good. I personally don’t use HassIO, because I prefer to have a “universal” Linux to build on.
I got my PEAK adapter working by following this guide (+ the socketcan docu):
https://python-can.readthedocs.io/en/master/interfaces/socketcan.html

About your canable.io:
I am pretty sure that the default firmware will be some kind of broken Chinese crap. If I got an canable.io-adapter, I would definitely flash the official firmware to make the device apear as a generic CAN device - no hassle around with unknown and undocumented default crap.

There is maybe an workaround for HassOs, gonna try it tomorrow, if i do a ssh access to the HassOs itself, on port 22222, there is a specific folder thats not read only, a folder to load extra modules in the kernel…

It’s only 3 modules i need to load, to make the can0 appear…nothing todo with firmware…

Cause making af extra addon will not solve my issue, since it will use the same OS kernel…

Afterwards it should be pretty easy i can just add the can-utils and the socket can for python, that’s easy to load with a custom component…

The below 3 i need to add in kernel, then it should work and then I can bring the can0 bus online with those other commands…

sudo modprobe can

sudo modprobe can_raw

sudo modprobe slcan

To bring can0 online, i have also found i a tutorial todo it in a python script, should be easy

I think I’ve lost track :sweat_smile:
What are you doing/planning currently? Just to get the hardware recognized and running?

Yeah, that’s the most important stuff, otherwise I’m not able to join the project :slight_smile:
Would be usefull for others too maybe that are running HassOs

hey @danielschramm, while googling i also find this board, SN65HVD230, its a 3.3v instead of 5v

see also here: https://www.beyondlogic.org/adding-can-controller-area-network-to-the-raspberry-pi/

is that board also supported on ESPHome? so we dont need that level shifter anymore?
but also, that board has less pin’s not sure how to wire it?

This is the board I already successfully used in other projects. Where is your problem about the wiring?
Basically this is plain SPI with (MO)SI, (MI)SO, clock and chip select. The INT line is not necessarily needed (but helps). Let me know which pins are unclear :slight_smile: .

ah, but i dont see those SPI MO and MI pinns on that board? only like tx and rx ? :slight_smile:

but i also think if i want to use it in esphome, there needs a change too
anway, i have asked for a request to use canbus devices to in HassOS, gonna make a PR