Настраиваю mbgate:
Часть конфига из секции inputs:
{
"topic": "hwmon/CPU Temperature",
"address": 5395,
"unitId": 9,
"meta_type": "temperature",
"enabled": true,
"format": "signed",
"size": 2,
"max": 0,
"scale": 1,
"byteswap": false,
"wordswap": false
},
Он работает:
systemctl status wb-mqtt-mbgate
● wb-mqtt-mbgate.service - Wiren Board MQTT to Modbus TCP gateway
Loaded: loaded (/lib/systemd/system/wb-mqtt-mbgate.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2023-05-15 16:22:24 UTC; 2min 13s ago
Process: 19397 ExecStartPre=/usr/bin/wb-mqtt-mbgate-confgen -c /etc/wb-mqtt-mbgate.conf (code=exited, status=0/SUCCESS)
Main PID: 19405 (wb-mqtt-mbgate)
Tasks: 3 (limit: 2354)
Memory: 2.0M
CPU: 1.837s
CGroup: /system.slice/wb-mqtt-mbgate.service
└─19405 /usr/bin/wb-mqtt-mbgate -c /etc/wb-mqtt-mbgate.conf
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate-confgen[19397]: Topic wb-map6s_27/S 5 taken from old config
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate-confgen[19397]: Topic wb-map6s_27/S 6 taken from old config
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate-confgen[19397]: Topic wb-map6s_27/Serial taken from old config
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate-confgen[19397]: Topic wb-map6s_27/Urms taken from old config
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate-confgen[19397]: Topic wbrules/Rule debugging taken from old config
May 15 16:22:24 wirenboard-AWI3MCGC systemd[1]: Started Wiren Board MQTT to Modbus TCP gateway.
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate[19405]: INFO: [modbus] Modbus listening
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate[19405]: INFO: [mbgate] Start loops
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate[19405]: INFO: [mqtt] connection estabilished with code "0" <success>
May 15 16:22:24 wirenboard-AWI3MCGC wb-mqtt-mbgate[19405]: INFO: [mqtt] subscription succeeded (message id 1)
Из важного в логе:
May 15 17:02:37 wirenboard-AWI3MCGC systemd[1]: Started Wiren Board MQTT to Modbus TCP gateway.
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Modbus configuration: device /dev/ttyRS485-2, baud rate 9600, parity N, data bits 8, stop bits 2
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] MQTT configuration: host /var/run/mosquitto/mosquitto.sock, port 0, keepalive 60
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Processing store 2
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Processing store 1
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Processing store 8
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Processing store 4
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Element hwmon/CPU Temperature : 5395
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [config] Creating observer on 5395:1
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: DEBUG: [modbus] Modbus cache allocated
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: INFO: [modbus] Modbus listening
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: INFO: [mbgate] Start loops
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: INFO: [mqtt] connection estabilished with code "0" <success>
May 15 17:02:37 wirenboard-AWI3MCGC wb-mqtt-mbgate[8082]: INFO: [mqtt] subscription succeeded (message id 1)
Проверяю:
modbus_client --debug -mrtu -pnone -s2 -b9600 /dev/ttyRS485-1 -a9 -t0x04 -r5395
Opening /dev/ttyRS485-1 at 9600 bauds (N, 8, 2)
[09][04][15][13][00][01][C5][4B]
Waiting for a confirmation...
<09><04><02><00><23><19><28>
SUCCESS: read 1 of elements:
Data: 0x0023
Включите пожалуйста debug в конфиге mbgate и проверте что тудапишется при запросах.