{
  "$schema": "https://raw.githubusercontent.com/nobrega8/mbmap-library/main/schema/mbmap-2.schema.json",
  "mbmap": 2,
  "vendor": "Unipi Technology",
  "model": "Patron S167",
  "models": [
    "Patron S167"
  ],
  "vendor_website": "www.unipi.technology",
  "description": "Modbus TCP PLC unit with 4 digital inputs, 4 digital outputs, 1 analog output and 1 analog input, plus LTE connection status",
  "x_status": "official",
  "revision": 3,
  "revised": "2026-11-10",
  "source": "Patron S167 Modbus map v2.0, Unipi technology",
  "sources": [
    {
      "title": "Patron S167 Modbus map",
      "version": "2.0",
      "url": "https://kb.unipi.technology/_media/files:products:patron:unipi-patron-s167-modbus-map-v2.0.pdf",
      "note": "Registers and Coils sheets"
    }
  ],
  "notes": [
    "Registers are 0-based and use the Unit 0 addresses of the document, which cover every section of the device. Multi-register values (32-bit counters, serial number, floats) are read here with the most significant register first, as the document states.",
    "Reserved, obsolete and internal registers, and registers reachable only through a section unit (Unit 1 to 3), are left out."
  ],
  "protocol": "tcp",
  "unit_id": 0,
  "port": 502,
  "byte_order": "big",
  "word_order": "big",
  "address_base": 0,
  "enums": {
    "ai_mode_ui": {"0": "Voltage 0-10 V", "1": "Current 0-20 mA"},
    "ao_mode": {"0": "Voltage 0-10 V", "1": "Current 0-20 mA", "3": "Resistance 0-2 kohm"},
    "lte_connection_mode": {"0": "INIT", "1": "LTE on", "2": "LTE off", "3": "ETH on", "4": "LTE on, ETH off", "5": "LTE off, ETH on", "6": "LTE on, ETH on", "7": "LTE off, ETH off", "8": "ETH off"},
    "lte_network_type": {"0": "GSM", "1": "GSM compact", "2": "UTRAN", "3": "GSM/GPRS with EDGE availability", "4": "UTRAN with HSDPA availability", "5": "UTRAN with HSUPA availability", "6": "UTRAN with HSDPA and HSUPA availability", "7": "LTE"}
  },
  "registers": [
    {"name": "Digital Input 1.1", "group": "Digital inputs", "area": "holding", "address": 0, "type": "bool", "bit": 0, "access": "R"},
    {"name": "Digital Input 1.2", "group": "Digital inputs", "area": "holding", "address": 0, "type": "bool", "bit": 1, "access": "R"},
    {"name": "Digital Input 1.3", "group": "Digital inputs", "area": "holding", "address": 0, "type": "bool", "bit": 2, "access": "R"},
    {"name": "Digital Input 1.4", "group": "Digital inputs", "area": "holding", "address": 0, "type": "bool", "bit": 3, "access": "R"},
    {"name": "Digital Output 1.1", "group": "Digital outputs", "area": "holding", "address": 1, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "Digital Output 1.2", "group": "Digital outputs", "area": "holding", "address": 1, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Digital Output 1.3", "group": "Digital outputs", "area": "holding", "address": 1, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Digital Output 1.4", "group": "Digital outputs", "area": "holding", "address": 1, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "VRefInt of MCU", "group": "Info", "area": "holding", "address": 5, "type": "uint16", "access": "R", "description": "Reference voltage of the MCU (raw)"},
    {"name": "MWD Enable", "group": "Watchdog", "area": "holding", "address": 6, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "MWD Reboot Detected", "group": "Watchdog", "area": "holding", "address": 6, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Counter of Digital Input 1.1", "group": "Counters", "area": "holding", "address": 8, "type": "uint32", "access": "RW", "description": "Pulse counter; writable to reset"},
    {"name": "Counter of Digital Input 1.2", "group": "Counters", "area": "holding", "address": 10, "type": "uint32", "access": "RW", "description": "Pulse counter; writable to reset"},
    {"name": "Counter of Digital Input 1.3", "group": "Counters", "area": "holding", "address": 12, "type": "uint32", "access": "RW", "description": "Pulse counter; writable to reset"},
    {"name": "Counter of Digital Input 1.4", "group": "Counters", "area": "holding", "address": 14, "type": "uint32", "access": "RW", "description": "Pulse counter; writable to reset"},
    {"name": "PWM Duty Cycle of DO 1.1", "group": "PWM", "area": "holding", "address": 16, "type": "uint16", "access": "RW", "description": "PWM duty cycle of the digital output"},
    {"name": "PWM Duty Cycle of DO 1.2", "group": "PWM", "area": "holding", "address": 17, "type": "uint16", "access": "RW", "description": "PWM duty cycle of the digital output"},
    {"name": "PWM Duty Cycle of DO 1.3", "group": "PWM", "area": "holding", "address": 18, "type": "uint16", "access": "RW", "description": "PWM duty cycle of the digital output"},
    {"name": "PWM Duty Cycle of DO 1.4", "group": "PWM", "area": "holding", "address": 19, "type": "uint16", "access": "RW", "description": "PWM duty cycle of the digital output"},
    {"name": "User LED 1.1", "group": "LEDs", "area": "holding", "address": 20, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "User LED 1.2", "group": "LEDs", "area": "holding", "address": 20, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "User LED 1.3", "group": "LEDs", "area": "holding", "address": 20, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "User LED 1.4", "group": "LEDs", "area": "holding", "address": 20, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "Synchronised DO/RO 1.1", "group": "Synchronised outputs", "area": "holding", "address": 21, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "Synchronised DO/RO 1.2", "group": "Synchronised outputs", "area": "holding", "address": 21, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Synchronised DO/RO 1.3", "group": "Synchronised outputs", "area": "holding", "address": 21, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Synchronised DO/RO 1.4", "group": "Synchronised outputs", "area": "holding", "address": 21, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "Synchronised DO/RO Lock 1.1", "group": "Synchronised outputs", "area": "holding", "address": 22, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "Synchronised DO/RO Lock 1.2", "group": "Synchronised outputs", "area": "holding", "address": 22, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Synchronised DO/RO Lock 1.3", "group": "Synchronised outputs", "area": "holding", "address": 22, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Synchronised DO/RO Lock 1.4", "group": "Synchronised outputs", "area": "holding", "address": 22, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "Firmware Version", "group": "Info", "area": "holding", "address": 1000, "type": "uint16", "access": "R", "role": "firmware", "description": "Firmware version of the section (raw number)"},
    {"name": "Number of DIs", "group": "Info", "area": "holding", "address": 1001, "type": "uint16", "bit": 0, "bits": 8, "access": "R"},
    {"name": "Number of DOs", "group": "Info", "area": "holding", "address": 1001, "type": "uint16", "bit": 8, "bits": 8, "access": "R"},
    {"name": "Number of internal RS485 lines", "group": "Info", "area": "holding", "address": 1002, "type": "uint16", "bit": 0, "bits": 4, "access": "R"},
    {"name": "Number of AOs", "group": "Info", "area": "holding", "address": 1002, "type": "uint16", "bit": 4, "bits": 4, "access": "R"},
    {"name": "Number of AIs", "group": "Info", "area": "holding", "address": 1002, "type": "uint16", "bit": 8, "bits": 8, "access": "R"},
    {"name": "Firmware ID", "group": "Info", "area": "holding", "address": 1003, "type": "uint16", "access": "R"},
    {"name": "Hardware ID", "group": "Info", "area": "holding", "address": 1004, "type": "uint16", "access": "R"},
    {"name": "PCB Serial Number", "group": "Info", "area": "holding", "address": 1005, "type": "uint32", "access": "R", "role": "serial"},
    {"name": "RS485 RX queue not empty", "group": "Interrupt mask", "area": "holding", "address": 1007, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "RS485 TX queue empty", "group": "Interrupt mask", "area": "holding", "address": 1007, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "RS485 ModBus RX frame finished", "group": "Interrupt mask", "area": "holding", "address": 1007, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Digital Input changed state", "group": "Interrupt mask", "area": "holding", "address": 1007, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "MWD Timeout (in 1ms)", "group": "Watchdog", "area": "holding", "address": 1008, "type": "uint16", "access": "RW", "unit": "ms"},
    {"name": "VRef of MCU", "group": "Info", "area": "holding", "address": 1009, "type": "uint16", "access": "R", "description": "Reference voltage of the MCU (raw)"},
    {"name": "Debounce time (in 100us) for DI 1.1", "group": "Settings", "area": "holding", "address": 1010, "type": "uint16", "access": "RW", "scale": 0.1, "unit": "ms", "description": "Raw unit is 100 us"},
    {"name": "Debounce time (in 100us) for DI 1.2", "group": "Settings", "area": "holding", "address": 1011, "type": "uint16", "access": "RW", "scale": 0.1, "unit": "ms", "description": "Raw unit is 100 us"},
    {"name": "Debounce time (in 100us) for DI 1.3", "group": "Settings", "area": "holding", "address": 1012, "type": "uint16", "access": "RW", "scale": 0.1, "unit": "ms", "description": "Raw unit is 100 us"},
    {"name": "Debounce time (in 100us) for DI 1.4", "group": "Settings", "area": "holding", "address": 1013, "type": "uint16", "access": "RW", "scale": 0.1, "unit": "ms", "description": "Raw unit is 100 us"},
    {"name": "Enable DirectSwitch on DI 1.1", "group": "DirectSwitch", "area": "holding", "address": 1014, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "Enable DirectSwitch on DI 1.2", "group": "DirectSwitch", "area": "holding", "address": 1014, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Enable DirectSwitch on DI 1.3", "group": "DirectSwitch", "area": "holding", "address": 1014, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Enable DirectSwitch on DI 1.4", "group": "DirectSwitch", "area": "holding", "address": 1014, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "Invert DirectSwitch Polarity on DI 1.1", "group": "DirectSwitch", "area": "holding", "address": 1015, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "Invert DirectSwitch Polarity on DI 1.2", "group": "DirectSwitch", "area": "holding", "address": 1015, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Invert DirectSwitch Polarity on DI 1.3", "group": "DirectSwitch", "area": "holding", "address": 1015, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Invert DirectSwitch Polarity on DI 1.4", "group": "DirectSwitch", "area": "holding", "address": 1015, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "Enable DirectSwitch Toggle on DI 1.1", "group": "DirectSwitch", "area": "holding", "address": 1016, "type": "bool", "bit": 0, "access": "RW"},
    {"name": "Enable DirectSwitch Toggle on DI 1.2", "group": "DirectSwitch", "area": "holding", "address": 1016, "type": "bool", "bit": 1, "access": "RW"},
    {"name": "Enable DirectSwitch Toggle on DI 1.3", "group": "DirectSwitch", "area": "holding", "address": 1016, "type": "bool", "bit": 2, "access": "RW"},
    {"name": "Enable DirectSwitch Toggle on DI 1.4", "group": "DirectSwitch", "area": "holding", "address": 1016, "type": "bool", "bit": 3, "access": "RW"},
    {"name": "Section PWM prescaler", "group": "PWM", "area": "holding", "address": 1017, "type": "uint16", "access": "RW"},
    {"name": "Section PWM cycle length", "group": "PWM", "area": "holding", "address": 1018, "type": "uint16", "access": "RW"},
    {"name": "Analog Output Configuration 1.1", "group": "Analog", "area": "holding", "address": 1019, "type": "uint16", "access": "RW", "enum": "ao_mode"},
    {"name": "Analog Output Voltage deviation 1.1", "group": "Analog", "area": "holding", "address": 1020, "type": "uint16", "access": "RW"},
    {"name": "Analog Output Voltage offset 1.1", "group": "Analog", "area": "holding", "address": 1021, "type": "uint16", "access": "RW"},
    {"name": "Analog Output Current deviation 1.1", "group": "Analog", "area": "holding", "address": 1022, "type": "uint16", "access": "RW"},
    {"name": "Analog Output Current offset 1.1", "group": "Analog", "area": "holding", "address": 1023, "type": "uint16", "access": "RW"},
    {"name": "Analog Input Configuration 1.1", "group": "Analog", "area": "holding", "address": 1024, "type": "uint16", "access": "RW", "enum": "ai_mode_ui"},
    {"name": "Analog Input Voltage deviation 1.1", "group": "Analog", "area": "holding", "address": 1025, "type": "uint16", "access": "RW"},
    {"name": "Analog Input Voltage offset 1.1", "group": "Analog", "area": "holding", "address": 1026, "type": "uint16", "access": "RW"},
    {"name": "Analog Input Current deviation 1.1", "group": "Analog", "area": "holding", "address": 1027, "type": "uint16", "access": "RW"},
    {"name": "Analog Input Current offset 1.1", "group": "Analog", "area": "holding", "address": 1028, "type": "uint16", "access": "RW"},
    {"name": "Analog Input/Output Voltage deviation (input side) 1.1", "group": "Analog", "area": "holding", "address": 1029, "type": "uint16", "access": "RW"},
    {"name": "Analog Input/Output Voltage offset (input side) 1.1", "group": "Analog", "area": "holding", "address": 1030, "type": "uint16", "access": "RW"},
    {"name": "Analog Output value 1.1", "group": "Analog", "area": "holding", "address": 3000, "type": "float32", "access": "RW", "description": "Value in the unit of the configured mode (V, mA or ohm)"},
    {"name": "Analog Input value 1.1", "group": "Analog", "area": "holding", "address": 3002, "type": "float32", "access": "R", "description": "Value in the unit of the configured mode (V, mA or ohm)"},
    {"name": "Storage - Erase cycles used [%]", "group": "Storage", "area": "holding", "address": 4000, "type": "uint16", "access": "R", "unit": "%"},
    {"name": "Storage - Good blocks [%]", "group": "Storage", "area": "holding", "address": 4001, "type": "uint16", "access": "R", "unit": "%"},
    {"name": "Connection - Mode", "group": "Connection", "area": "holding", "address": 4200, "type": "uint16", "access": "R", "enum": "lte_connection_mode"},
    {"name": "Connection - Network type", "group": "Connection", "area": "holding", "address": 4201, "type": "uint16", "access": "R", "enum": "lte_network_type"},
    {"name": "Connection - RSSI [dBm]", "group": "Connection", "area": "holding", "address": 4202, "type": "int16", "unit": "dBm", "access": "R", "description": "-48 to -99 dBm"},
    {"name": "Connection - Signal quality", "group": "Connection", "area": "holding", "address": 4203, "type": "uint16", "access": "R", "description": "0 (good) to 7 (bad), 99 unknown"},
    {"name": "Digital Output 1.1 (coil)", "group": "Digital outputs", "area": "coil", "address": 0, "type": "bool", "access": "RW"},
    {"name": "Digital Output 1.2 (coil)", "group": "Digital outputs", "area": "coil", "address": 1, "type": "bool", "access": "RW"},
    {"name": "Digital Output 1.3 (coil)", "group": "Digital outputs", "area": "coil", "address": 2, "type": "bool", "access": "RW"},
    {"name": "Digital Output 1.4 (coil)", "group": "Digital outputs", "area": "coil", "address": 3, "type": "bool", "access": "RW"},
    {"name": "Digital Input 1.1 (coil)", "group": "Digital inputs", "area": "coil", "address": 4, "type": "bool", "access": "R"},
    {"name": "Digital Input 1.2 (coil)", "group": "Digital inputs", "area": "coil", "address": 5, "type": "bool", "access": "R"},
    {"name": "Digital Input 1.3 (coil)", "group": "Digital inputs", "area": "coil", "address": 6, "type": "bool", "access": "R"},
    {"name": "Digital Input 1.4 (coil)", "group": "Digital inputs", "area": "coil", "address": 7, "type": "bool", "access": "R"},
    {"name": "User Programmable LED 1.1", "group": "LEDs", "area": "coil", "address": 8, "type": "bool", "access": "RW"},
    {"name": "User Programmable LED 1.2", "group": "LEDs", "area": "coil", "address": 9, "type": "bool", "access": "RW"},
    {"name": "User Programmable LED 1.3", "group": "LEDs", "area": "coil", "address": 10, "type": "bool", "access": "RW"},
    {"name": "User Programmable LED 1.4", "group": "LEDs", "area": "coil", "address": 11, "type": "bool", "access": "RW"},
    {"name": "MWD reset indication", "group": "Commands", "area": "coil", "address": 1000, "type": "bool", "access": "RW", "description": "Clears the MWD reboot indication"},
    {"name": "Enable/Disable 1Wire Bus", "group": "Commands", "area": "coil", "address": 1001, "type": "bool", "access": "RW", "description": "Enable or disable the 1-Wire bus"},
    {"name": "Reset section MCU", "group": "Commands", "area": "coil", "address": 1002, "type": "bool", "access": "W"},
    {"name": "Save current configuration and use on startup", "group": "Commands", "area": "coil", "address": 1003, "type": "bool", "access": "W", "description": "Stores the current configuration so it is used at startup"}
  ]
}
