Hunv / can2mqtt

A Linux or Windows service to forward CAN frames to MQTT messages. Optimized for Stiebel Eltron (at the Moment) but works for all.
MIT License
20 stars 11 forks source link

Waveshare RS485 CAN HAT #20

Open Oldscrewdriver opened 7 months ago

Oldscrewdriver commented 7 months ago

Hi,

I have no /dev/can0 , only a can0 Interface. So I can't setup a sllcan0?

The 'candump -tz can0' is running.

BG

Hunv commented 7 months ago

Hi, just for understanding: In you Linux root folder is a device called "can0"? In other words: if you run ls / you see an object called can0?

Oldscrewdriver commented 7 months ago

Hi, no there exists no /dev/can0. I have only a can0 network interface: ifconfig can0 can0: flags=193<UP,RUNNING,NOARP> mtu 16 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC) RX packets 2182 bytes 15274 (14.9 KiB) RX errors 0 dropped 48 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Hunv commented 7 months ago

Ah, OK. I never had something like this, but maybe you can skip the chapter Setup the CAN Bus connection and use your can0 instead of slcan0 in the steps after (interface name of the service configuration and the interface name in the config file).

Oldscrewdriver commented 7 months ago

seems in a older issue the same error occurs when a can0 canHAT is used.

I aslo get:

Using network interface 'eth0' Listen adress is 192.168.2.160 Netmask is 255.255.255.0 Broadcast adress is 192.168.2.255 creating broadcast thread... binding socket to 192.168.2.160:29536 client connected client tried to access unauthorized bus. Closing client connection. client connected client tried to access unauthorized bus. Closing client connection.

I used: in the config.jason

"CanInterfaceName":"can0",

oduzus commented 7 months ago

Hi, I saw your post in the old topic and now see that your Interface is "running". do not forget the space in the json file "CanInterface": "can0", and also the socketcan daemon need to be adjusted ExecStart=/opt/socketcand/socketcand -i can0 -l eth0 -v

Oldscrewdriver commented 7 months ago

Hi, thank you for your fast response!

But I have some trouble to run the can2mqtt-core version. Load this and try to run , but seems I used truely a older version which not can handle the

CanInterface": "can0" option in the json file.

Please can you help? I must build the can2mqtt.dll as new? How I do it?

oduzus commented 7 months ago

Sorry, I can not support you with that. But if you go to the code section of the repository and check the code changes between version 4.2 and 4.3 you will find the places where the can interface has been made variable.

Oldscrewdriver commented 7 months ago

No problem, found what to do:

running "dotnet build" does the job, I get now frames from CAN and they ended to MQTT

Many thanks for your work!

Hunv commented 7 months ago

@Oldscrewdriver : You can also download the already build files at releases at https://github.com/Hunv/can2mqtt/releases/tag/v4.4 Just download and unpack the zip file.