I have this code which works great from CLI:
https://paste.pythondiscord.com/TQEQ
It's expected output is:
DEBUG:main:Performing direct I2C read test
DEBUG:main:Test Read Data: 0x0FF0, Processed Value: 0xF00F
INFO:main:Channel 1: ON
INFO:main:Channel 2: ON
INFO:main:Channel 3: ON
INFO:main:Channel 4: ON
INFO:main:Channel 5: OFF
INFO:main:Channel 6: OFF
INFO:main:Channel 7: OFF
INFO:main:Channel 8: OFF
INFO:main:Channel 9: OFF
INFO:main:Channel 10: OFF
INFO:main:Channel 11: OFF
INFO:main:Channel 12: OFF
INFO:main:Channel 13: ON
INFO:main:Channel 14: ON
INFO:main:Channel 15: ON
INFO:main:Channel 16: ON
That code proves that the PCF8575 module is correctly connected and the values can be read via I2C.
I need help with the code from: https://paste.pythondiscord.com/2N5Q
The issue is that the values are not correctly read, the value for all outputs (16) is 'None'
measurement state: {‘button_0_state’: None, ‘button_1_state’: None, ‘button_2_state’: None, ‘button_3_state’: None, ‘button_4_state’: None, ‘button_5_state’: None, ‘button_6_state’: None, ‘button_7_state’: None, ‘button_8_state’: None, ‘button_9_state’: None, ‘button_10_state’: None, ‘button_11_state’: None, ‘button_12_state’: None, ‘button_13_state’: None, ‘button_14_state’: None, ‘button_15_state’: None}
2024-08-10 22:19:02,837 - DEBUG - mycodo.controllers.controller_input_5443884c - Adding measurements to InfluxDB with ID 5443884c-1fe8-4379-b818-8bfac05de5e1: {}