Hello,
Can somebody help me with the following config problem?
I have a modbus sensor working.
No issue with that.
Now this sensor is reading an modbus input register type of my WAGO PLC.
I receive the result and it completely reflects the amounts I expect…
However I need to convert this in binary as the decimal result is a combination of bits.
One bit is representing an output of my PLC (for example a lamp or a motor of my ventilation etc)
Reading the modbus sensor manual I see the following :
Data_type : custom
Structure: python struct format string to unpack the value
So seen the above and to my understanding it should be possible to “EXTRACT” a bit out of the received decimal register.
For example the register is showing now 394 which is 110001010 in binary which tells me that the PLC has 4 outputs “on” as they are on 1 and 5 “off” as they are on 0.
The solution I am looking for is of the kind of “modbuskitchensensor = on if bit 5 of the received modbus register is 1”.
The solution could be perhaps be templating or the combination with data_type and structure.
In none of the possible solutions I have made any progress…
So who of the coding goeroes can help me?
Happy newyear and already thanks in advance
Regards