all work fine
Code: Select all
################################ Configuration ################################
# Name of an existing MQTT broker that should be used for publishing
:local broker "MQTT"
# MQTT topic where the message should be published
:local topic "modbuss/Temperature/DS18B20"
#################################### System ###################################
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x1 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x2 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x3 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x4 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x5 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x6 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x7 reg-addr=0x0 as-value once]
:local modbusread [/iot modbus read-holding-registers slave-id=0x08 num-regs=0x8 reg-addr=0x0 as-value once]
:local modbus [:put [($modbusread->"values")]]
#################################### MQTT #####################################
:local message \
"{\"TEMP\":\"$modbus\"}"
###info LOG fails
# :log info "$message";
:put ("[*] Total message size: $[:len $message] bytes")
:put ("[*] Sending message to MQTT broker...")
/iot mqtt publish broker=$broker topic=$topic message=$message
:put ("[*] Done")
how i can get just a simple string like - {228, 32768, 32768, 227, .....} ?
and if i understand right from script i can get only whole numbers? than i need make divide at other side not script..
Thanks.