What am I doing wrong here?
Was still on a much earlier commit, so updated today. Made a new db file, that went without issue. But pethub is not happy.
pethub | HAMQTTIP connecting to 192.168.241.12
pethub | Starting Pet Hub
pethub | Connecting to Home Assistant MQTT endpoint at 192.168.241.12 port 1883
pethub | Load Devices from pethublocal.db and create Home Assistant MQTT discovery config topics
pethub | Loading Hub: Home hub
pethub | Traceback (most recent call last):
pethub | File "pethubmqtt.py", line 384, in <module>
pethub | states.hub=Box({"State":Online(device.state).name, "Uptime":"0 Mins", "Name": dev, "Serial": device.serial_number,"MAC Address": mac, "LED Mode":Enabled(device.led_mode).name, "Pairing Mode":Enabled(device.pairing_mode).name })
pethub | File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
pethub | return cls.__new__(cls, value)
pethub | File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
pethub | raise ve_exc
pethub | ValueError: 4 is not a valid Enabled
pethub exited with code 1
sqlite> select * from devices;
0000801F121D6719|1|Home hub|H004-0088731||||{"device": {"hardware": 3, "firmware": 2.43}}
D98122FEFFEC1054|3|Kitchen||2.9012|-75|-76.4|{"lcd": {"hardware": 1, "firmware": 1}, "rf": {"hardware": 4, "firmware": 0.16}}
sqlite> select * from hubs;
0000801F121D6719|4|0|1|0
sqlite> select * from doors;
D98122FEFFEC1054|0|12:01|12:02|0|000000
sqlite> select * from pets;
711033360D00|Ziva|2
4C4B0A355500|Jessie|2
992.003000057158|Vuur|1
992.003000057159|Vlam|1
Ran it again with debug:
pethub | Starting Pet Hub
pethub | Connecting to Home Assistant MQTT endpoint at 192.168.241.12 port 1883
pethub | SQLite init database response: {'devices': [{'name': 'Home hub', 'product_id': 1, 'mac_address': '0000801F121D6719', 'serial_number': 'H004-0088731', 'version': '{"device": {"hardware": 3, "firmware": 2.43}}', 'state': 1, 'battery': '', 'led_mode': 4, 'pairing_mode': 0, 'curfewenabled': None, 'lock_time': None, 'unlock_time': None, 'lockingmode': None, 'bowl1': None, 'bowl2': None, 'bowltarget1': None, 'bowltarget2': None, 'bowltype': None, 'close_delay': None}, {'name': 'Kitchen', 'product_id': 3, 'mac_address': 'D98122FEFFEC1054', 'serial_number': '', 'version': '{"lcd": {"hardware": 1, "firmware": 1}, "rf": {"hardware": 4, "firmware": 0.16}}', 'state': None, 'battery': '2.9012', 'led_mode': None, 'pairing_mode': None, 'curfewenabled': 0, 'lock_time': '12:01', 'unlock_time': '12:02', 'lockingmode': 0, 'bowl1': None, 'bowl2': None, 'bowltarget1': None, 'bowltarget2': None, 'bowltype': None, 'close_delay': None}], 'pets': [{'name': 'Ziva', 'species': 2, 'device': 'Kitchen', 'product_id': 3, 'state': 2}, {'name': 'Jessie', 'species': 2, 'device': 'Kitchen', 'product_id': 3, 'state': 1}, {'name': 'Vuur', 'species': 1, 'device': 'Kitchen', 'product_id': 3, 'state': 2}, {'name': 'Vlam', 'species': 1, 'device': None, 'product_id': None, 'state': None}]}
pethub | Load Devices from pethublocal.db and create Home Assistant MQTT discovery config topics
pethub | {'name': 'Home hub', 'product_id': 1, 'mac_address': '0000801F121D6719', 'serial_number': 'H004-0088731', 'version': '{"device": {"hardware": 3, "firmware": 2.43}}', 'state': 1, 'battery': '', 'led_mode': 4, 'pairing_mode': 0, 'curfewenabled': None, 'lock_time': None, 'unlock_time': None, 'lockingmode': None, 'bowl1': None, 'bowl2': None, 'bowltarget1': None, 'bowltarget2': None, 'bowltype': None, 'close_delay': None}
pethub | Loading Hub: Home hub
pethub | Hub DB record: {'name': 'Home hub', 'product_id': 1, 'mac_address': '0000801F121D6719', 'serial_number': 'H004-0088731', 'version': '{"device": {"hardware": 3, "firmware": 2.43}}', 'state': 1, 'battery': '', 'led_mode': 4, 'pairing_mode': 0, 'curfewenabled': None, 'lock_time': None, 'unlock_time': None, 'lockingmode': None, 'bowl1': None, 'bowl2': None, 'bowltarget1': None, 'bowltarget2': None, 'bowltype': None, 'close_delay': None}
pethub | Traceback (most recent call last):
pethub | File "pethubmqtt.py", line 384, in <module>
pethub | states.hub=Box({"State":Online(device.state).name, "Uptime":"0 Mins", "Name": dev, "Serial": device.serial_number,"MAC Address": mac, "LED Mode":Enabled(device.led_mode).name, "Pairing Mode":Enabled(device.pairing_mode).name })
pethub | File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
pethub | return cls.__new__(cls, value)
pethub | File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
pethub | raise ve_exc
pethub | ValueError: 4 is not a valid Enabled
pethub exited with code 1