Привет. Хочу в mqtt видеть счетчики разных типов нажатий.
У меня есть WB-MR6LV/I.
Контроллер его нашел и после накликанных настроек в UI добавил в wb-mqtt-serial.conf в таком виде:
{
"device_type" : "WB-MR6C",
"in1_mode" : 6,
"in1_out1_sp" : 3,
"in2_mode" : 6,
"in2_out2_sp" : 3,
"in3_mode" : 6,
"in3_out3_sp" : 3,
"in4_mode" : 6,
"in4_out4_sp" : 3,
"in5_mode" : 6,
"in5_out5_sp" : 3,
"in6_mode" : 6,
"in6_out6_sp" : 3,
"out1_safety_behaviour" : 0,
"out1_safety_input_control" : 0,
"out2_safety_behaviour" : 0,
"out2_safety_input_control" : 0,
"out3_safety_behaviour" : 0,
"out3_safety_input_control" : 0,
"out4_safety_behaviour" : 0,
"out4_safety_input_control" : 0,
"out5_safety_behaviour" : 0,
"out5_safety_input_control" : 0,
"out6_safety_behaviour" : 0,
"out6_safety_input_control" : 0,
"outputs_restore_state" : 1,
"safety_timer_s" : 10,
"slave_id" : "59"
},
Предполагаю, что для такого device_type используется шаблон /usr/share/wb-mqtt-serial/templates/config-wb-mr6c.json
root@wb:~# grep -nR WB-MR6C /usr/share/wb-mqtt-serial/templates/config-wb-mr6* | grep device_type
/usr/share/wb-mqtt-serial/templates/config-wb-mr6c.json:3: "device_type": "WB-MR6C",
/usr/share/wb-mqtt-serial/templates/config-wb-mr6c-nc.json:3: "device_type": "WB-MR6C-NC",
/usr/share/wb-mqtt-serial/templates/config-wb-mr6cu.json:3: "device_type": "WB-MR6CU",
/usr/share/wb-mqtt-serial/templates/config-wb-mr6cv3.json:3: "device_type": "WB-MR6C v.3",
В шаблоне вижу channel:
{
"name": "Input 1 Long Press Counter",
"enabled": false,
"reg_type": "press_counter",
"address": 480,
"type": "value",
"sporadic": true,
"group": "gg_in1_channels",
"condition": "in1_mode==6"
},
Condition этого channel выполняется (см выше, in1_mode выставлен в 6).
Почему тогда я не вижу Input 1 Long Press Counter в mqtt explorer и в UI? См. скриншот:
Доп детали:
root@wb:~# cat /etc/wb-release
RELEASE_NAME=wb-2504
SUITE=stable
TARGET=wb7/bullseye
root@wb:~# dpkg -l | grep mqtt-serial
ii wb-mqtt-serial 2.160.3-wb102 armhf Wiren Board Smart Home MQTT serial protocol driver
root@wb:~# dpkg -l | grep mosquitto
ii libmosquitto1:armhf 2.0.20-1-wb102 armhf MQTT version 5.0/3.1.1/3.1 client library
ii libmosquittopp1:armhf 2.0.20-1-wb102 armhf MQTT version 5.0/3.1.1/3.1 client C++ library
ii mosquitto 2.0.20-1-wb102 armhf MQTT version 5.0/3.1.1/3.1 compatible message broker
ii mosquitto-clients 2.0.20-1-wb102 armhf Mosquitto command line MQTT clients
Я, конечно, понимаю, что можно самому добавить channel вручную в wb-mqtt-serial.conf. Но это ведь должно быть “из коробки”, разве нет?
Как сделать так, чтобы счетчики типов нажатий без ручной конфигурации правильно проросли в mqtt?