HotNoob / PythonProtocolGateway

Python Protocol Gateway reads data via Modbus RTU or other protocols and translates the data for MQTT. In the long run, Python Protocol Gateway will become a general purpose protocol gateway to translate between more than just modbus and mqtt. Growatt, EG4, Sigineer, SOK, PACE
Apache License 2.0
14 stars 4 forks source link

flexible bit value reading with template in csv column #7

Closed HotNoob closed 7 months ago

HotNoob commented 7 months ago

some registers are holding sub-byte sized values. ie, 1bit, 2 bits, 4 bits in size.

so on the todo to add support for reading theese values. i'm thinking maybe this as the format. in the csv. its a bit of a hack {#bits:variable_name},{#bits:variable_name},... to be put into either the data_type column or documented name column.

or alternatively, could do it via register numbers and data type, with b4 being the starting bit, and data type defining the size. ie, data type: 4bits, register 70 data type: 2bits, register 70.b4 data type: 4bits, register 70.b6

leaning towards data_type and register, as its more clean.

HotNoob commented 7 months ago

done, but untested. also added bit flag reading. did test it with 16bit val, which is a no duh. so it should work....

data type: 4bits, register 70 data type: 2bits, register 70.b4 data type: 4bits, register 70.b6

is the format i went with.