first try and errors:
openhabian@openhabian:~ $ python3 -m pip install -U bluetooth-clocks
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting bluetooth-clocks
Downloading https://files.pythonhosted.org/packages/65/a5/432269d8d7d8c0143711ce4f197a327b1285e03342e92a0ddbe3f7129d0a/bluetooth_clocks-0.1.2-py3-none-any.whl
Requirement already satisfied, skipping upgrade: bleak>=0.19.0 in ./.local/lib/python3.7/site-packages (from bluetooth-clocks) (0.19.5)
Requirement already satisfied, skipping upgrade: importlib-metadata; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from bluetooth-clocks) (6.0.0)
Requirement already satisfied, skipping upgrade: async-timeout<5,>=3.0.0 in ./.local/lib/python3.7/site-packages (from bleak>=0.19.0->bluetooth-clocks) (4.0.2)
Requirement already satisfied, skipping upgrade: dbus-fast<2.0.0,>=1.22.0; platform_system == "Linux" in ./.local/lib/python3.7/site-packages (from bleak>=0.19.0->bluetooth-clocks) (1.84.0)
Requirement already satisfied, skipping upgrade: typing-extensions<5.0.0,>=4.2.0; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from bleak>=0.19.0->bluetooth-clocks) (4.4.0)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->bluetooth-clocks) (3.12.0)
Installing collected packages: bluetooth-clocks
Found existing installation: bluetooth-clocks 0.1.1
Uninstalling bluetooth-clocks-0.1.1:
Successfully uninstalled bluetooth-clocks-0.1.1
Successfully installed bluetooth-clocks-0.1.2
openhabian@openhabian:~ $ bluetooth-clocks discover -s 30
Scanning for supported clocks...
Found a PVVX: address A4:C1:38:9A:E4:40, name ATC_9AE440
Found a PVVX: address A4:C1:38:DD:13:4E, name ATC_DD134E
Found a PVVX: address A4:C1:38:20:C2:AB, name ATC_20C2AB
Found a PVVX: address A4:C1:38:34:A4:EC, name ATC_34A4EC
Found a PVVX: address A4:C1:38:C6:AF:20, name ATC_C6AF20
Found a PVVX: address A4:C1:38:66:DC:AD, name ATC_66DCAD
Found a PVVX: address A4:C1:38:D6:5E:0B, name ATC_D65E0B
Found a PVVX: address A4:C1:38:5A:D0:87, name ATC_5AD087
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Writing time to device...
Traceback (most recent call last):
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 177, in connect
member="Connect",
File "/home/openhabian/.local/lib/python3.7/site-packages/dbus_fast/aio/message_bus.py", line 371, in call
await future
concurrent.futures._base.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 210, in set_clock_time
await clock.set_time(timestamp, args.am_pm)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__init__.py", line 335, in set_time
async with BleakClient(self.address) as client:
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 433, in __aenter__
await self.connect()
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 471, in connect
return await self._backend.connect(**kwargs)
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 177, in connect
member="Connect",
File "/home/openhabian/.local/lib/python3.7/site-packages/async_timeout/__init__.py", line 129, in __aexit__
self._do_exit(exc_type)
File "/home/openhabian/.local/lib/python3.7/site-packages/async_timeout/__init__.py", line 212, in _do_exit
raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/openhabian/.local/bin/bluetooth-clocks", line 10, in <module>
sys.exit(run())
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 28, in run
asyncio.run(main(sys.argv[1:]))
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 41, in main
await cli_args.func(cli_args)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 216, in set_clock_time
except asyncio.exceptions.TimeoutError as exc:
AttributeError: module 'asyncio' has no attribute 'exceptions'
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks discover -s
usage: bluetooth-clocks discover [-h] [-s SCAN_DURATION]
bluetooth-clocks discover: error: argument -s/--scan-duration: expected one argument
openhabian@openhabian:~ $
after rpi reboot
openhabian@openhabian:~ $ bluetooth-clocks discover
Scanning for supported clocks...
Found a PVVX: address A4:C1:38:DD:13:4E, name ATC_DD134E
Found a PVVX: address A4:C1:38:66:DC:AD, name ATC_66DCAD
Found a PVVX: address A4:C1:38:9A:E4:40, name ATC_9AE440
Found a PVVX: address A4:C1:38:20:C2:AB, name ATC_20C2AB
Found a PVVX: address A4:C1:38:34:A4:EC, name ATC_34A4EC
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks discover 30
usage: bluetooth-clocks [-h] [--version] [-v] [-vv] {discover,get,set} ...
bluetooth-clocks: error: unrecognized arguments: 30
openhabian@openhabian:~ $ bluetooth-clocks discover -s 30
Scanning for supported clocks...
Found a PVVX: address A4:C1:38:34:A4:EC, name ATC_34A4EC
Found a PVVX: address A4:C1:38:9A:E4:40, name ATC_9AE440
Found a PVVX: address A4:C1:38:20:C2:AB, name ATC_20C2AB
Found a PVVX: address A4:C1:38:66:DC:AD, name ATC_66DCAD
Found a PVVX: address A4:C1:38:D6:5E:0B, name ATC_D65E0B
Found a PVVX: address A4:C1:38:5A:D0:87, name ATC_5AD087
Found a PVVX: address A4:C1:38:DD:13:4E, name ATC_DD134E
openhabian@openhabian:~ $ bluetooth-clocks discover -s 60
Scanning for supported clocks...
Found a PVVX: address A4:C1:38:9A:E4:40, name ATC_9AE440
Found a PVVX: address A4:C1:38:66:DC:AD, name ATC_66DCAD
Found a PVVX: address A4:C1:38:C6:AF:20, name ATC_C6AF20
Found a PVVX: address A4:C1:38:5A:D0:87, name ATC_5AD087
Found a PVVX: address A4:C1:38:34:A4:EC, name ATC_34A4EC
Found a PVVX: address A4:C1:38:DD:13:4E, name ATC_DD134E
Found a PVVX: address A4:C1:38:D6:5E:0B, name ATC_D65E0B
Found a PVVX: address A4:C1:38:20:C2:AB, name ATC_20C2AB
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Writing time to device...
Synchronized time
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC -t 2023-01-10T16:20
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC -t 2023-01-10T16:20
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks discover -s 30
Scanning for supported clocks...
Found a PVVX: address A4:C1:38:DD:13:4E, name ATC_DD134E
Found a PVVX: address A4:C1:38:C6:AF:20, name ATC_C6AF20
Found a PVVX: address A4:C1:38:9A:E4:40, name ATC_9AE440
Found a PVVX: address A4:C1:38:34:A4:EC, name ATC_34A4EC
Found a PVVX: address A4:C1:38:66:DC:AD, name ATC_66DCAD
Found a PVVX: address A4:C1:38:20:C2:AB, name ATC_20C2AB
^[[B^[[Aopenhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC -t 2023-01-10T16:20
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC -t 2023-01-10T16:20
Scanning for device A4:C1:38:34:A4:EC...
Writing time to device...
Synchronized time
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Writing time to device...
Traceback (most recent call last):
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 210, in set_clock_time
await clock.set_time(timestamp, args.am_pm)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__init__.py", line 335, in set_time
async with BleakClient(self.address) as client:
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 433, in __aenter__
await self.connect()
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 471, in connect
return await self._backend.connect(**kwargs)
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 207, in connect
dangerous_use_bleak_cache=dangerous_use_bleak_cache
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 591, in get_services
self._device_path, dangerous_use_bleak_cache
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/manager.py", line 573, in get_services
await self._wait_for_services_discovery(device_path)
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/manager.py", line 672, in _wait_for_services_discovery
raise BleakError("failed to discover services, device disconnected")
bleak.exc.BleakError: failed to discover services, device disconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/openhabian/.local/bin/bluetooth-clocks", line 10, in <module>
sys.exit(run())
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 28, in run
asyncio.run(main(sys.argv[1:]))
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 41, in main
await cli_args.func(cli_args)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 216, in set_clock_time
except asyncio.exceptions.TimeoutError as exc:
AttributeError: module 'asyncio' has no attribute 'exceptions'
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Writing time to device...
Traceback (most recent call last):
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 177, in connect
member="Connect",
File "/home/openhabian/.local/lib/python3.7/site-packages/dbus_fast/aio/message_bus.py", line 371, in call
await future
concurrent.futures._base.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 210, in set_clock_time
await clock.set_time(timestamp, args.am_pm)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__init__.py", line 335, in set_time
async with BleakClient(self.address) as client:
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 433, in __aenter__
await self.connect()
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 471, in connect
return await self._backend.connect(**kwargs)
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 177, in connect
member="Connect",
File "/home/openhabian/.local/lib/python3.7/site-packages/async_timeout/__init__.py", line 129, in __aexit__
self._do_exit(exc_type)
File "/home/openhabian/.local/lib/python3.7/site-packages/async_timeout/__init__.py", line 212, in _do_exit
raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/openhabian/.local/bin/bluetooth-clocks", line 10, in <module>
sys.exit(run())
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 28, in run
asyncio.run(main(sys.argv[1:]))
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 41, in main
await cli_args.func(cli_args)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 216, in set_clock_time
except asyncio.exceptions.TimeoutError as exc:
AttributeError: module 'asyncio' has no attribute 'exceptions'
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Didn't find device A4:C1:38:34:A4:EC.
openhabian@openhabian:~ $ bluetooth-clocks set -a A4:C1:38:34:A4:EC
Scanning for device A4:C1:38:34:A4:EC...
Writing time to device...
Traceback (most recent call last):
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 210, in set_clock_time
await clock.set_time(timestamp, args.am_pm)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__init__.py", line 335, in set_time
async with BleakClient(self.address) as client:
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 433, in __aenter__
await self.connect()
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/__init__.py", line 471, in connect
return await self._backend.connect(**kwargs)
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 190, in connect
assert_reply(reply)
File "/home/openhabian/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation already in progress
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/openhabian/.local/bin/bluetooth-clocks", line 10, in <module>
sys.exit(run())
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 28, in run
asyncio.run(main(sys.argv[1:]))
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 41, in main
await cli_args.func(cli_args)
File "/home/openhabian/.local/lib/python3.7/site-packages/bluetooth_clocks/__main__.py", line 216, in set_clock_time
except asyncio.exceptions.TimeoutError as exc:
AttributeError: module 'asyncio' has no attribute 'exceptions'
openhabian@openhabian:~ $
So conclusion:
- Iβve got 8 ATC thermometers - sorry forget about one . It is discovered when I set longer discovery time 60s.
- Donβt know why but there is a problem with connecting to thermometer ( it was less than a 1m from rpi ) . It dosenβt connect everytime or there is error when writing settings . Only solution is removing battery from thermometer. I use new battery for sure.
- The best one - if it connect properly it set good time !
- The almost last one
- as previously I can do more test if you need.
- The last one - I use OMG with RF on ESP and TheengsGateway in container but is there a chance to add RF support to TheengsGateway ? I know that we need RF parts but Rpi has a lot GPIOs and that will be nice to reduce number of devices needed to run . Second thing is reducing energy consumption.