raspi-turntouch
raspi-turntouch copied to clipboard
AttributeError: 'TurnTouch' object has no attribute 'battery_status_characteristic'
I have some really odd behaviour. I managed to connect to the Turntouch after a while (the battery was nearly down so it never showed up in the gatt discovery). Now I can't use it with the sample config. When I press a button I get:
22:33:10,751 dbus.connection ERROR Exception in handler for D-Bus signal: Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/dbus/connection.py", line 232, in maybe_handle_message self._handler(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/gatt/gatt_linux.py", line 539, in properties_changed self.service.device.characteristic_value_updated(characteristic=self, value=bytes(value)) File "/home/pi/raspi-turntouch/monitor.py", line 93, in characteristic_value_updated if characteristic == self.battery_status_characteristic: AttributeError: 'TurnTouch' object has no attribute 'battery_status_characteristic'
and when I use > sudo python3 monitor.py -p I get the following output:
Config loaded: [{'name': 'turntouch', 'mac': 'dd:60:xx:xx:xx:xx', 'buttons': {'north_press': {'type': 'bash', 'command': 'echo "Hello North"'}, 'north_double': {'type': 'bash', 'command': 'echo "Double North"'}, 'north_hold': {'type': 'bash', 'command': 'echo "Hold North"'}, 'east_press': {'type': 'bash', 'command': 'echo "Hello East"'}, 'east_double': {'type': 'bash', 'command': 'echo "Double East"'}, 'east_hold': {'type': 'bash', 'command': 'echo "Hold East"'}, 'south_press': {'type': 'bash', 'command': 'echo "Hello South"'}, 'south_double': {'type': 'bash', 'command': 'echo "Double South"'}, 'south_hold': {'type': 'bash', 'command': 'echo "Hold South"'}, 'west_press': {'type': 'bash', 'command': 'echo "Hello West"'}, 'west_double': {'type': 'bash', 'command': 'echo "Double West"'}, 'west_hold': {'type': 'bash', 'command': 'echo "Hold West"'}, 'battery_10': {'type': 'bash', 'command': 'echo "Battery Low!"'}}}] Found command of type bash, trying to load controller Initialised BashController Trying to connect to turntouch at dd:... Traceback (most recent call last): File "monitor.py", line 220, in
device.connect() File "/usr/local/lib/python3.7/dist-packages/gatt/gatt_linux.py", line 288, in connect self._connect() File "/usr/local/lib/python3.7/dist-packages/gatt/gatt_linux.py", line 295, in _connect self.services_resolved() File "monitor.py", line 77, in services_resolved battery_status_service = next(s for s in self.services StopIteration