yeah, i noticed earlier in the first stages by luck, that he was developing this for ESPHome
so tested some stuff for him with the hardware setup
i am quite happy with it, i was always already able to control my lights and other stuff by TCP commands, but the wallswitches are based on canbus, so i can now intercept them and do more then just turn on lights
next phase is sending canbus messages, allthough i dont need it for now
Hi!
Sorry for my late response.
What do you mean? Do you mean with my custom hardware or with the PCAN device? Or with Homeassistent in general?
Sadly I have been busy with private stuff lately. So there was nothing possible but a little bit of soldering…
No, not yet. But because of HA does currently not know anything about CAN bus, the only option would be to flash the firmware for a virtual serial port onto the canable. So HA would just interact with this serial interface - from my point of view, this is not a desirable way to go, because most advantages of CAN bus compared to serial would be down the sink…
Ok, I had time to investigate in this a little bit.
I played around with the Linux tools “can-utils”, which worked pretty fine with my PCAN USB adapter.
My fundamental idea about the integration into HA was to have sensor components for different CAN IDs.
Based in this I played around with candump: it is possible to start different candump-processes in parallel, listening to different CAN IDs (with filters).
Describing it in my easy and immature words, each CAN sensor could start its own candump-process (or whatever), listening to its own identifier. The data-field could then be treated similar to a MQTT payload.
So from my point of view, the CAN bus sensor component architecture itself would not violate the current usage style.
I am quite familiar with CAN bus, but not with the HA programming. So if there is anyone who is familiar with creating sensor components, I would be happy to support with CAN bus and testing.
If there is no chance to get CAN bus integrated into HA, you could start as many candump-processes as you like to listen to different CAN IDs which write their outputs to individual files. Then you could create file sensor components in HA that observe these files. Of course, this is a quite crappy way to do it. But at least this could work…
i hope @OpenJeDi respons, i know he bought an adapter too, he made a custom component before
we use somekind of domotica controller for our lighs/plugs, it also uses canbus
i know he was interesred, since his custom was based on TCP api, and he wanted canbus too
Sp i hope he is reading community forums
Hopefully…
Currently I only own a PCAN USB adapter, which appears as native CAN bus device in Linux. For now this is fine and native CAN support should be the desirable way. But if necessary I could also buy a canable.io module for setting up identical testing conditions.
I still use the MCP2515 adapter, for reading canbus, i have it hooked up to an ESP8266 , so working with ESPHome now… works great, allthoug i prefer to use it with a ready USB hardware adapter like canable
Well, at least in my case, the driver is present OOTB. The SocketCAN driver collection is in the Linux kernel since 2.6.25 - so basically it should be plug and play (at least from the hardware driver side).
I already tried to set up the development environment by myself. That worked relatively good. But I get stuck at the point where it gets serious (programming). The python-library is there, the drivers are there, but I have just no idea what to do …
Hey, maybe we should start easy, instead of creating a component or a custom component, why not run a .py script in background, that just reads/writes canbus messages? i am ready doing something similar right now… When i startup HA… i run a script thats stays in background HA… its actually a socket script that reads/writes data from another hardware component, based on information i receive/get, i just send REST calls to HA to turn on a sevice like below curl script
there are plenty of example scrips on internet on python that reads/write canbus messages
what do you think?
example REST command "curl -k -X POST -H \"Authorization: Bearer XXXXX\" -d '{\"entity_id\": \"script.xxx\"}' http://127.0.0.1:8123/api/services/script/turn_on"
with automation below i start up a script in background HA
Please don’t get me wrong, I don’t want to degrade your effort in any way. But from my point of view, running a script and providing a REST API is the same as my idea with the file-sensor: a workaround.
The goal should be to integrate that into HA natively. Your approach as well as my idea with the file-sensor do not integrate anything into HA: we take HA as it is and try to fill the gap between HA and our CAN bus hardware by scripts - but in the end the gap persists.
I try to get in touch with developers via Discord or I write them PMs via github. Now that I’ve set up my development environment, I should not stop here…
i also sended @OpenJeDi i message on github, i know he wants canbus too, and he is python developer
he is not active on communitry , so i hope he receives the message now