gavinying / modpoll

A New Command-line Tool for Modbus and MQTT
https://gavinying.github.io/modpoll
MIT License
84 stars 17 forks source link

Ommiting Addresses Prior to a Specified Coil #31

Closed tteddy623 closed 6 months ago

tteddy623 commented 8 months ago

Config file:

device,relay1,1 poll,discrete_input,4,1,LE_LE ref,relay1,4,bool8,r

Expected Output:

+--------+------+---------+---------------------------------------------------------+ | name | unit | address | value | +--------+------+---------+---------------------------------------------------------+ | relay1 | None | 4 | [False] | +--------+------+---------+---------------------------------------------------------+

Observed Output:

+--------+------+---------+---------------------------------------------------------+ | name | unit | address | value | +--------+------+---------+---------------------------------------------------------+ | relay1 | None | 4 | [False, False, True, False, False, False, False, False] | +--------+------+---------+---------------------------------------------------------+

Any change to the config either discrete_input or coil, etc results in a [NONE] value if I can manage to get it to filter out the rest of the addresses. The polling is working fine its just that there should be a way to obtain a single coil's state. The output above makes for MQTT messaging impossible as other relay states will ruin the succcess parameters.

gavinying commented 8 months ago

@tteddy623 The output format is actually following the Modbus standard,

image

As above mentioned, Modbus read coils response is alwasys 1 or n bytes, modpoll tool will then forward the complete data to MQTT, but as data consumer, you can always select the target bit(s) from the received bytes on application level.

gavinying commented 6 months ago

Close it since no activity for long time.