routeros-iot
Installation
SKILL.md
RouterOS IoT
Most features need the extra package iot (and iot-bt-extra for USB Bluetooth dongles on ARM and ARM64 devices with USB, LE 4.0 or newer; RouterOS 7.18
and later). Install it as described in routeros-install-upgrade, then check /iot exists. Hardware matters: Bluetooth chip and GPIO are on
KNOT-class devices (and RBM33G for GPIO), Modbus needs the RS485 port (KNOT, KNOT LR8G and LR9G kits), LoRa needs an R11e-LR2, LR8 or LR9 mini-PCIe card
(routeros-hardware has the product manuals and find_product.py).
MQTT
RouterOS is an MQTT publisher and subscriber (from 7.11); a broker such as Mosquitto can run in a container (routeros-containers).
/iot/mqtt/brokers/add name=broker address=192.168.88.33 port=1883 client-id=router1 keep-alive=60 auto-connect=yes
/iot/mqtt/connect broker=broker
/iot/mqtt/publish broker=broker topic="site/router1/status" message="ok" qos=1 retain=no
/iot/mqtt/subscribe broker=broker topic="site/+/cmd" qos=1
/iot/mqtt/subscriptions/set 0 on-message="/log info \"mqtt message\"" # script runs per received message (7.12+)
/iot/mqtt/brokers/print