Написание функции, высчитывающей корректную температуру, шаблон Uponor Smatrix Base PRO Controller X-147

Можете подсказать, как проверить версию?

dpkg -s wb-mqtt-serial

root@wirenboard-ACF6YBP3:~# dpkg -s wb-mqtt-serial
Package: wb-mqtt-serial
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 1679
Maintainer: Evgeny Boger boger@contactless.ru
Architecture: armhf
Version: 2.6.3
Replaces: wb-homa-modbus (<< 1.14.1)
Depends: libc6 (>= 2.4), libgcc1 (>= 1:3.5), libjsoncpp1 (>= 1.7.4), libstdc++6 (>= 6), libwbmqtt1 (>= 1.0.4), init-system-helpers (>= 1.18~), ucf, bsdutils
Breaks: wb-homa-modbus (<< 1.14.1), wb-mqtt-confed (<< 1.0.2), wb-mqtt-homeui (<< 1.7)
Conffiles:
/etc/wb-configs.d/11wb-mqtt-serial 25dea7134dcb1cd4ec4e4f33524635e0
/etc/wb-mqtt-serial.conf.sample c8c1adbf630e6fd7ec871b1b5c4a5e0f
/etc/init.d/wb-mqtt-serial 1f6938ea476ac51c4b845327d5e40f03 obsolete
Description: Wiren Board Smart Home MQTT serial protocol driver.
root@wirenboard-ACF6YBP3:~#

Версия свежая, воспроизводится. Будем фиксить.

Прошу прощения, забыл вылозжить методику воспроизведения:
Добавляем в любой шаблон устройства со 121 регистром следующее:

            {
                "name": "test",
                "type": "value",
                "reg_type": "input",
                "address": 121,
                "format": "u16",
                "scale": 0.555555,
                "offset": -17.333
            }

При запуске в логе:

wb-mqtt-serial[25370]: ERROR: [serial] offset is not a int value

Так что поведение корректное, но оффсет только целый.

Исправлено в версии 2.6.6.

1 лайк

Подскажите пожалуйста, как мне её установить? И когда будет исправлено в стабильных версиях?

sed -i 's/^#deb/deb/g' /etc/apt/sources.list.d/wb-unstable.list 
apt update
apt install wb-mqtt-serial=2.6.8
1 лайк

А когда будет исправлено в стабильных версиях?

Сейчас вот такая фигня вылезла при добавлении множества каналов у устройства: https://youtu.be/NH4Shbo6aHY

Если выключить устройство и оставить такое же, но с меньшим числом каналов- всё ок.

Что в логе wb-mqtt-serial?

journalctl -u wb-mqtt-serial --no-pager > log.txt

Какое количество регистров запрашивается одновременно, в одном запросе?
Как известно, длина посылки Modbus RTU не модет быть больше 252 байт.
Что указано в “max_read_registers”?
Выложите шаблон пожалуйста.

Сейчас обнаружил, что у меня в конфиге два одинаковых канала у девайса было. Убрал клона- всё стало ок

Можете прислать кусок шаблона с этими дублирующимися каналами, чтобы мы добавили корректную обработку такой ситуации?

Вот, два RoomSetTemp5

Конфиг
{
  "slave_id": "1",
  "name": "Uponor 1 floor",
  "id": "uponor_1",
  "enabled": true,
  "protocol": "modbus",
  "poll_interval": 1500,
  "channels": [
    {
      "name": "Actuator1",
      "type": "switch",
      "reg_type": "discrete",
      "address": 1,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator2",
      "type": "switch",
      "reg_type": "discrete",
      "address": 2,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator3",
      "type": "switch",
      "reg_type": "discrete",
      "address": 3,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator4",
      "type": "switch",
      "reg_type": "discrete",
      "address": 4,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator5",
      "type": "switch",
      "reg_type": "discrete",
      "address": 5,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator6",
      "type": "switch",
      "reg_type": "discrete",
      "address": 6,
      "format": "u16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator7",
      "type": "switch",
      "reg_type": "discrete",
      "address": 7,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator8",
      "type": "switch",
      "reg_type": "discrete",
      "address": 8,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator9",
      "type": "switch",
      "reg_type": "discrete",
      "address": 9,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator10",
      "type": "switch",
      "reg_type": "discrete",
      "address": 10,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator11",
      "type": "switch",
      "reg_type": "discrete",
      "address": 11,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "Actuator12",
      "type": "switch",
      "reg_type": "discrete",
      "address": 12,
      "format": "s16",
      "scale": 1,
      "offset": 0
    },
    {
      "name": "RoomRealTemp1",
      "type": "value",
      "reg_type": "input",
      "address": 2,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp2",
      "type": "value",
      "reg_type": "input",
      "address": 3,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp3",
      "type": "value",
      "reg_type": "input",
      "address": 4,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp4",
      "type": "value",
      "reg_type": "input",
      "address": 5,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp5",
      "type": "value",
      "reg_type": "input",
      "address": 6,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp6",
      "type": "value",
      "reg_type": "input",
      "address": 7,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp7",
      "type": "value",
      "reg_type": "input",
      "address": 8,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp8",
      "type": "value",
      "reg_type": "input",
      "address": 9,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp9",
      "type": "value",
      "reg_type": "input",
      "address": 10,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp10",
      "type": "value",
      "reg_type": "input",
      "address": 11,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp11",
      "type": "value",
      "reg_type": "input",
      "address": 12,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomRealTemp12",
      "type": "value",
      "reg_type": "input",
      "address": 13,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp1",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 1,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp2",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 2,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp3",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 3,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp4",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 4,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp5",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 5,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp5",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 5,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp6",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 6,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp7",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 7,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp8",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 8,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp9",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 9,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp10",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 10,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp11",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 11,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    },
    {
      "name": "RoomSetTemp12",
      "type": "value",
      "reg_type": "holding_multi",
      "address": 12,
      "format": "s16",
      "scale": 0.055555556,
      "offset": -17.777778
    }
  ],
  "device_max_fail_cycles": 1000
}

В принципе, всё работает, но значения всё-таки не очень корректные приходят. как правильнее будет их “причесать”? Round_to?

image

Да, как в https://github.com/wirenboard/wb-mqtt-serial/:

1 лайк

Смотрите, температуру в комнате до округления показывает 13,5555555, по факту, на терморегуляторе показывает 13,5. При округлении до десятых, округляется по математическим правилам до 13,6. Как мне просто “отсечь” лишнее, без округления?

{
  "name": "RoomRealTemp1",
  "type": "value",
  "reg_type": "input",
  "address": 1,
  "format": "s16",
  "scale": 0.055555556,
  "offset": -17.777778,
  "round_to": 0.01
}

Всё ещё жду ответа)