Skip to content

[Bug]: Modbus register updates not sent via WebSocket on Unipi Patron M207 #214

@JakubRanosz

Description

@JakubRanosz

Prerequisites

  • I am running the latest Evok version
  • I have searched other issues

Describe the bug

I have a temperature sensor connected to RS485 port 1.3 on the Unipi Patron M207, and communication with the sensor is established via Modbus. The actual temperature value can be successfully read via the REST API at:
http://192.168.1.10/rest/register/TQS4-4_100. However, updates to register TQS4-4_100 are not being transmitted via WebSocket. Other updates (e.g., AI, DI) are sent as expected. In previous versions of Evok (v2), Modbus register updates were transmitted correctly. The issue appears in the latest version of Evok.

/etc/evok/config.yaml

# EVOK CONFIGURATION FILE

#   +------------------+
#   | Autogen settings |
#   +------------------+
autogen: true
# ^ if autogen is enabled, '/etc/evok/autogen.yaml' will be included.
# ^ Autogen file is generated by unipi-os-configurator if installed.
# ^ The file contain basic comm_channels configuration for your device.

#   +------------------+
#   | Logging settings |
#   +------------------+
logging:
  level: WARNING
  # ^ Minimum severity of messages to be logged, where minimum is CRITICAL.
  # ^ Options: [CRITICAL, ERROR, WARNING, INFO, DEBUG]

#   +--------------+
#   | API settings |
#   +--------------+
apis:
  port: 8080
  # ^ API listen port
  # ^ only change if you are certain you know what you are doing
  # ^ FOR OUR WEB INTERFACE THE PORT SHOULD BE CHANGED IN "etc/nginx/sites-available/evok" TOO !!!

  address: 127.0.0.1
  # ^ API listen address
  # ^ to listen on all interfaces set this paramater to empty or remove it
  # ^ FOR OUR WEB INTERFACE THE PORT SHOULD BE CHANGED IN "etc/nginx/sites-available/evok" TOO !!!

  websocket:
    enabled: true
    all_filtered: false
    # ^ 'All' WebSocket requests will be subject to the filtering set by 'filter'

  webhook:
    enabled: false
    address: http://127.0.0.1:80
    device_mask: ["input","wd"]
    # ^ List of device types to notify on (written as a JSON list) - adding AI will generate a large amount of messages!
    complex_events: false
    # ^ EVOK will send POST requests with the same data as WebSocket, rather than an empty GET request

#   +------------------------+
#   | Hardware Configuration |
#   +------------------------+
# comm_channels is list of connected devices and theirs settings.
# Here you can define your connected extensions.

# ----------- STRUCTURE -----------

# comm_channels:
#   <bus_name>
#     type: <bus_type>
#     <specific settings>
#     devices:
#       <device_name>:
#         slave-id: <slave_id>
#         model: <model_id>

# notes:
#   <bus_name>: Your choice, but cannot be duplicates!
#   <bus_type>:
#       - MODBUSTCP (specific settings: [hostname, port])
#       - MODBUSRTU (specific settings: [port, boudrate, parity])
#   <device_name>: Under this name, the device will be available in the API. Cannot be duplicates!
#   <model_id>: Defines a modbus register map. Source is in '.yaml' files in '/etc/evok/hw_definitions'.
#               ^ examples [xS51, xS11, ]


# ----------- EXAMPLES -----------
#comm_channels:
#  RS485_1:
#    type: MODBUSRTU
#    port: /dev/ttyNS0
#    baudrate: 19200
#    parity: 'N'
#    devices:
#      xS51:
#        slave-id: 1
#        model: xS51
#      my_device_name_1:
#        slave-id: 5
#        model: xS11
#  RS485_2:
#    type: MODBUSRTU
#    port: /dev/ttyNS1
#    baudrate: 9600
#    parity: 'N'
#    devices:
#      my_device_name_2:
#        slave-id: 1
#        model: xS51
#  EXT_TCP:
#    type: MODBUSTCP
#    hostname: 192.168.0.54
#    port: 502
#    devices:
#      my_device_name_3:
#        slave-id: 1
#        model: 00
#  MY_TCP:
#    type: MODBUSTCP
#    hostname: 192.168.0.55
#    port: 502
#    devices:
#      my_device_name_4:
#        slave-id: 11
#        model: my_modbus_map

comm_channels:
  RS485_1_3:
    type: MODBUSRTU
    port: /dev/ttymxc0
    baudrate: 57600
    parity: 'N'
    stop-bits: 1
    devices:
      TQS4-4:
        slave-id: 4
        model: TQS4
        scan_frequency: 2

/etc/evok/hw_definitions/TQS4.yaml

# Custom device TQS4
# File version: 1.0
# Min. firmware version: 0.1
---
# This key defines which Modbus registers will be periodically read. Each block (also sometimes referred to as "group") is read once ever ["frequency"] read cycles
modbus_register_blocks:
    - start_reg   : 99
      count       : 2
      frequency   : 5

# This defines the devices mapped to the registers above. As custom devices are very unlikely to support any Neuron features, the only devices which should be mapped a>
modbus_features:
    - type        : REGISTER
      count       : 1
      start_reg   : 99

    - type        : REGISTER
      count       : 1
      start_reg   : 100

Evok log

INFO:evok:Starting Evok v3.0.6 using config directory '/etc/evok'.
INFO:evok:Setting logging level to 'DEBUG'.
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/00.yaml, definition count 0
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS11.yaml, definition count 1
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS50.yaml, definition count 2
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS53.yaml, definition count 3
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/IAQ-THC.yaml, definition count 4
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/CUSTOM_MODBUS_DEVICE.yaml, definition count 5
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/0A.yaml, definition count 6
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS10.yaml, definition count 7
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/IAQ-TH.yaml, definition count 8
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xG18.yaml, definition count 9
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/13.yaml, definition count 10
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS30.yaml, definition count 11
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/08.yaml, definition count 12
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/TQS4.yaml, definition count 13
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS52.yaml, definition count 14
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS51.yaml, definition count 15
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/07.yaml, definition count 16
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/09.yaml, definition count 17
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/0F.yaml, definition count 18
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS54.yaml, definition count 19
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/01.yaml, definition count 20
DEBUG:evok:YAML Definition loaded: /etc/evok/hw_definitions/xS40.yaml, definition count 21
DEBUG:evok:Load aliases with {}
INFO:evok:HTTP server API listening on 127.0.0.1:8080
DEBUG:evok:Registered new device 'tcp_bus' with circuit LOCAL_TCP        (<evok.config.TcpBusDevice object at 0xffff80ac7b10>)
DEBUG:evok:Registered new device 'device_info' with circuit M207         (<evok.config.DeviceInfo object at 0xffff80ac4690>)
INFO:evok:Creating bus 'LOCAL_TCP' with type 'MODBUSTCP' with devices.
INFO:evok:^ Creating device '1' with type 'MODBUSTCP'
DEBUG:evok:Registered new device 'modbus_slave' with circuit 1   (<evok.modbus_slave.ModbusSlave object at 0xffff80ac7190>)
INFO:evok:^ Creating device '2' with type 'MODBUSTCP'
DEBUG:evok:Registered new device 'modbus_slave' with circuit 2   (<evok.modbus_slave.ModbusSlave object at 0xffff80ac6650>)
DEBUG:evok:Registered new device 'owbus' with circuit OWBUS      (<evok.owdevice.OwBusDriver object at 0xffff80ac4810>)
INFO:evok:Creating bus 'OWBUS' with type 'OWFS'.
DEBUG:evok:Registered new device 'serial_bus' with circuit RS485_1_3     (<evok.config.SerialBusDevice object at 0xffff80ac4b50>)
INFO:evok:Creating bus 'RS485_1_3' with type 'MODBUSRTU' with devices.
INFO:evok:^ Creating device 'TQS4-4' with type 'MODBUSRTU'
DEBUG:evok:Registered new device 'modbus_slave' with circuit TQS4-4      (<evok.modbus_slave.ModbusSlave object at 0xffff80ac7850>)
DEBUG:evok:Registered new device 'device_info' with circuit TQS4-4       (<evok.config.DeviceInfo object at 0xffff80ac6e50>)
DEBUG:evok:Registered new device 'run' with circuit alias        (<evok.devices.Aliases object at 0xffff80abb110>)
INFO:evok:Initial reading the Modbus board on Modbus address 1  (1)
INFO:evok:Initial reading the Modbus board on Modbus address 2  (2)
INFO:evok:Initial reading the Modbus board on Modbus address 4  (TQS4-4)
INFO:evok:ServerRegistered(server=<Server:127.0.0.1:4304 closed>)
DEBUG:evok:Registered new device 'register' with circuit TQS4-4_99       (<evok.modbus_slave.Register object at 0xffff80b375d0>)
DEBUG:evok:Registered new device 'register' with circuit TQS4-4_100      (<evok.modbus_slave.Register object at 0xffff80b443d0>)
DEBUG:evok:Registered new device 'di' with circuit 2_01          (<evok.modbus_slave.DigitalInput object at 0xffff81898c10>)
DEBUG:evok:Registered new device 'di' with circuit 2_02          (<evok.modbus_slave.DigitalInput object at 0xffff80b44590>)
DEBUG:evok:Registered new device 'di' with circuit 2_03          (<evok.modbus_slave.DigitalInput object at 0xffff80b442d0>)
DEBUG:evok:Registered new device 'di' with circuit 2_04          (<evok.modbus_slave.DigitalInput object at 0xffff80b44610>)
DEBUG:evok:Registered new device 'di' with circuit 2_05          (<evok.modbus_slave.DigitalInput object at 0xffff80b44650>)
DEBUG:evok:Registered new device 'di' with circuit 2_06          (<evok.modbus_slave.DigitalInput object at 0xffff80b44750>)
DEBUG:evok:Registered new device 'di' with circuit 2_07          (<evok.modbus_slave.DigitalInput object at 0xffff80b44810>)
DEBUG:evok:Registered new device 'di' with circuit 2_08          (<evok.modbus_slave.DigitalInput object at 0xffff80b448d0>)
DEBUG:evok:Registered new device 'di' with circuit 2_09          (<evok.modbus_slave.DigitalInput object at 0xffff80b44990>)
DEBUG:evok:Registered new device 'di' with circuit 2_10          (<evok.modbus_slave.DigitalInput object at 0xffff80b449d0>)
DEBUG:evok:Registered new device 'di' with circuit 2_11          (<evok.modbus_slave.DigitalInput object at 0xffff80b44ad0>)
DEBUG:evok:Registered new device 'di' with circuit 2_12          (<evok.modbus_slave.DigitalInput object at 0xffff80b44b90>)
DEBUG:evok:Registered new device 'di' with circuit 2_13          (<evok.modbus_slave.DigitalInput object at 0xffff80b44c50>)
DEBUG:evok:Registered new device 'di' with circuit 2_14          (<evok.modbus_slave.DigitalInput object at 0xffff80b44d10>)
DEBUG:evok:Registered new device 'di' with circuit 2_15          (<evok.modbus_slave.DigitalInput object at 0xffff80b44dd0>)
DEBUG:evok:Registered new device 'di' with circuit 2_16          (<evok.modbus_slave.DigitalInput object at 0xffff80b44e90>)
DEBUG:evok:Registered new device 'ro' with circuit 2_01          (<evok.modbus_slave.Relay object at 0xffff80b44f50>)
DEBUG:evok:Registered new device 'ro' with circuit 2_02          (<evok.modbus_slave.Relay object at 0xffff80b44f90>)
DEBUG:evok:Registered new device 'ro' with circuit 2_03          (<evok.modbus_slave.Relay object at 0xffff80b45090>)
DEBUG:evok:Registered new device 'ro' with circuit 2_04          (<evok.modbus_slave.Relay object at 0xffff80b45150>)
DEBUG:evok:Registered new device 'ro' with circuit 2_05          (<evok.modbus_slave.Relay object at 0xffff80b45210>)
DEBUG:evok:Registered new device 'ro' with circuit 2_06          (<evok.modbus_slave.Relay object at 0xffff80b452d0>)
DEBUG:evok:Registered new device 'ro' with circuit 2_07          (<evok.modbus_slave.Relay object at 0xffff80b45390>)
DEBUG:evok:Registered new device 'ro' with circuit 2_08          (<evok.modbus_slave.Relay object at 0xffff80b45450>)
DEBUG:evok:Registered new device 'ro' with circuit 2_09          (<evok.modbus_slave.Relay object at 0xffff80b45510>)
DEBUG:evok:Registered new device 'ro' with circuit 2_10          (<evok.modbus_slave.Relay object at 0xffff80b455d0>)
DEBUG:evok:Registered new device 'ro' with circuit 2_11          (<evok.modbus_slave.Relay object at 0xffff80b45690>)
DEBUG:evok:Registered new device 'ro' with circuit 2_12          (<evok.modbus_slave.Relay object at 0xffff80b45750>)
DEBUG:evok:Registered new device 'ro' with circuit 2_13          (<evok.modbus_slave.Relay object at 0xffff80b45810>)
DEBUG:evok:Registered new device 'ro' with circuit 2_14          (<evok.modbus_slave.Relay object at 0xffff80b45850>)
DEBUG:evok:Registered new device 'watchdog' with circuit 2_01    (<evok.modbus_slave.Watchdog object at 0xffff80b458d0>)
DEBUG:evok:Registered new device 'nv_save' with circuit 2        (<evok.modbus_slave.NvSave object at 0xffff80b45990>)
INFO:evok:ServerConnected(server=<Server:127.0.0.1:4304 OK>)
DEBUG:evok:Registered new device 'di' with circuit 1_01          (<evok.modbus_slave.DigitalInput object at 0xffff80ad0bd0>)
DEBUG:evok:Registered new device 'di' with circuit 1_02          (<evok.modbus_slave.DigitalInput object at 0xffff80b45fd0>)
DEBUG:evok:Registered new device 'di' with circuit 1_03          (<evok.modbus_slave.DigitalInput object at 0xffff80b46190>)
DEBUG:evok:Registered new device 'di' with circuit 1_04          (<evok.modbus_slave.DigitalInput object at 0xffff80b46110>)
DEBUG:evok:Registered new device 'do' with circuit 1_01          (<evok.modbus_slave.DigitalOutput object at 0xffff80b462d0>)
DEBUG:evok:Registered new device 'do' with circuit 1_02          (<evok.modbus_slave.DigitalOutput object at 0xffff80b46390>)
DEBUG:evok:Registered new device 'do' with circuit 1_03          (<evok.modbus_slave.DigitalOutput object at 0xffff80b463d0>)
DEBUG:evok:Registered new device 'do' with circuit 1_04          (<evok.modbus_slave.DigitalOutput object at 0xffff80b46450>)
DEBUG:evok:Registered new device 'ai' with circuit 1_01          (<evok.modbus_slave.AnalogInput object at 0xffff80b464d0>)
DEBUG:evok:Registered new device 'ao' with circuit 1_01          (<evok.modbus_slave.AnalogOutputBrain object at 0xffff80b46590>)
DEBUG:evok:Registered new device 'led' with circuit 1_01         (<evok.modbus_slave.ULED object at 0xffff80b46610>)
DEBUG:evok:Registered new device 'led' with circuit 1_02         (<evok.modbus_slave.ULED object at 0xffff80b466d0>)
DEBUG:evok:Registered new device 'led' with circuit 1_03         (<evok.modbus_slave.ULED object at 0xffff80b46790>)
DEBUG:evok:Registered new device 'led' with circuit 1_04         (<evok.modbus_slave.ULED object at 0xffff80b467d0>)
DEBUG:evok:Registered new device 'owpower' with circuit 1        (<evok.modbus_slave.OwPower object at 0xffff80b46890>)
DEBUG:evok:Registered new device 'watchdog' with circuit 1_01    (<evok.modbus_slave.Watchdog object at 0xffff80b468d0>)
DEBUG:evok:Registered new device 'nv_save' with circuit 1        (<evok.modbus_slave.NvSave object at 0xffff80b46990>)
INFO:evok:BusAdded(bus=<Bus:<Server:127.0.0.1:4304 OK> /bus.2>)
INFO:evok:BusAdded(bus=<Bus:<Server:127.0.0.1:4304 OK> /bus.1>)
DEBUG:evok:New WebSocket client connected
DEBUG:evok:New WebSocket client connected

Steps to reproduce

No response

Expected behavior

Modbus register updates should be transmitted via WebSocket

Actual behavior

No updates are sent for Modbus register via WebSocket, while other updates are functioning correctly.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions