GithubHelp home page GithubHelp logo

rytilahti / python-eq3bt Goto Github PK

View Code? Open in Web Editor NEW
114.0 15.0 36.0 108 KB

Python library and command-line tool for eQ-3 Smart Bluetooth thermostats

License: MIT License

Python 100.00%
eq3 thermostat bluepy bleak btle gattlib python bluetooth-low-energy

python-eq3bt's Introduction

Hello! Hallo! Moi! ๐Ÿ‘‹

I am Teemu from ๐Ÿ‡ซ๐Ÿ‡ฎ, and I'm currently living in ๐Ÿ‡ฉ๐Ÿ‡ช, happy to see you here! I am currently looking for new opportunities, feel free to get in touch!

On this profile page, I present you some (automatically generated) information about my public contributions here on GitHub, mostly on projects useful for home automation.

According to GitHub, I have submitted 148 issues, 1,094 pull requests, and also written 5,130 issue comments here since 2013. Since then, my projects have been honored with a total of 5,218 โญ and 955 ๐Ÿด. I am happy if you have found my software, code reviews, help, or feedback useful! ๐Ÿฅฐ

Most of my Python projects are also available on the Python Package Index, which according to the PyPI Stats have been downloaded 830,668 times over the past month.

My projects

GitHub says that I am currently a maintainer or a collaborator in the following projects:

  1. rytilahti/python-miio โ€“ Python library & console tool for controlling Xiaomi smart appliances (3,376 โญ, 532 ๐Ÿด)
  2. python-kasa/python-kasa โ€“ ๐Ÿ ๐Ÿค– Python API for TP-Link Kasa Smarthome products (1,108 โญ, 186 ๐Ÿด)
  3. GadgetReactor/pyHS100 โ€“ Python Library to control TPLink Switch (HS100 / HS110) (405 โญ, 129 ๐Ÿด)
  4. rytilahti/python-eq3bt โ€“ Python library and command-line tool for eQ-3 Smart Bluetooth thermostats (114 โญ, 36 ๐Ÿด)
  5. rytilahti/python-yeelightbt โ€“ Python library for Yeelight's bedside (btle) and candela lamps (85 โญ, 26 ๐Ÿด)
Show more

  1. rytilahti/python-songpal โ€“ Python library for interfacing with Sony's Songpal devices (63 โญ, 24 ๐Ÿด)
  2. rytilahti/homeassistant-mpris-bridge โ€“ Control your Home Assistant media players from your desktop using MPRIS (21 โญ, 1 ๐Ÿด)
  3. rytilahti/homeassistant-upnp-availability โ€“ UPnP Availability sensor for Home Assistant (20 โญ, 6 ๐Ÿด)
  4. rytilahti/python-ubus โ€“ Python library for accessing ubus over JSON-RPC (16 โญ, 9 ๐Ÿด)
  5. DNS-OARC/ripe-hackathon-dns-caching โ€“ Everything you ever wanted to know about caching resolvers but were afraid to ask (4 โญ, 2 ๐Ÿด)
  6. rytilahti/python-nucled โ€“ Python interface for intel_nuc_led kernel driver (3 โญ, 1 ๐Ÿด)
  7. rytilahti/mqtt-bridge โ€“ "mqtt-bridge" -- execute shell commands on incoming MQTT messages (1 โญ, 0 ๐Ÿด)
  8. rytilahti/homeassistant-xiaomi-ng โ€“ None (1 โญ, 2 ๐Ÿด)
  9. RUB-SysSec/TurnkeyVPNStudy โ€“ None (0 โญ, 1 ๐Ÿด)

Recent contributions

In the past 371 days (since 20 May, 2023), I have submitted 232 pull requests on 14 different repositories, including:

Show more

Code Reviews

Besides contributing pull requests, I also try to help others by doing code reviews. During the previously mentioned time period, I have submitted 287 reviews to pull requests on 15 different repositories, including:

Show more

(Generated on 26 May, 2024)

python-eq3bt's People

Contributors

arekbulski avatar bimbar avatar bmarien avatar c-mauderer avatar dbuezas avatar helmutg avatar horsitis avatar hummel95 avatar jannau avatar klemens avatar krakowski avatar merll avatar microraptor avatar nakatomi845 avatar rytilahti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-eq3bt's Issues

Add parameter to allow choosing Bluetooth interface

Hi there,

first things first: Thanks a lot for your module, I'm using it for quite some time now and I am very happy with it!

I'd like to make a small feature request:
It would be helpful if you could select the Bluetooth interface that's being used by your module. I saw that bluepy supports this with the iface parameter (here) so I am hoping that this is only a small change and easy to implement.

Thanks

Can't talk to 'equiva' device

Hi,

I have an equiva thermostat (this: http://www.eq-3.com/products/eqiva/bluetooth-smart-radiator-thermostat.html) and I'm trying to communicate with it. I'm seeing the very same error as #5 - but I'm using python3.4. Here is a backtrace:

tinloaf@janeway ~ $ eq3cli --mac 00:1A:22:09:DE:DE --debug
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.connection:Trying to connect to 00:1A:22:09:DE:DE
DEBUG:eq3bt.connection:Connected to 00:1A:22:09:DE:DE
DEBUG:eq3bt.connection:Writing b'0311090a15251f' to 1041 with with_response=True
DEBUG:eq3bt.connection:Waiting for notifications for 1
Traceback (most recent call last):
  File "/home/tinloaf/.virtualenvs/hass/bin/eq3cli", line 11, in <module>
    sys.exit(cli())
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/eq3bt/eq3cli.py", line 38, in cli
    ctx.invoke(state)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/eq3bt/eq3cli.py", line 160, in state
    click.echo(dev)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/click/utils.py", line 221, in echo
    message = text_type(message)
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/eq3bt/eq3btsmart.py", line 97, in __str__
    self.mode_readable,
  File "/home/tinloaf/.virtualenvs/hass/lib64/python3.4/site-packages/eq3bt/eq3btsmart.py", line 265, in mode_readable
    if mode.MANUAL:
AttributeError: 'NoneType' object has no attribute 'MANUAL'

I'm also very certain that the device is not currently 'connected' - I just restarted my bluetooth subsystem as well as the thermostat itself. Also, it seems to establish the connection and write some data, but then something is going wrong. Is there any way I can debug this further?

Thanks for any assistance,

Lukas

Can't connect to thermostat

#2 Always get the following message trying to connect to the thermostat. I'm new to the world of programming so please help me :) I'm using a Raspberry Pi 3. What am I doing wrong?

pi@raspberrypi:~ $ eq3cli --mac 00:1A:22:08:29:FA Traceback (most recent call last): File "/usr/local/bin/eq3cli", line 9, in <module> load_entry_point('python-eq3bt==0.1.5', 'console_scripts', 'eq3cli')() File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1043, in invoke return Command.invoke(self, ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/eq3bt/eq3cli.py", line 27, in cli ctx.invoke(state) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/eq3bt/eq3cli.py", line 149, in state click.echo(dev) File "/usr/local/lib/python2.7/dist-packages/click/utils.py", line 221, in echo message = text_type(message) File "/usr/local/lib/python2.7/dist-packages/eq3bt/eq3btsmart.py", line 97, in __str__ self.mode_readable, File "/usr/local/lib/python2.7/dist-packages/eq3bt/eq3btsmart.py", line 267, in mode_readable if mode.MANUAL: AttributeError: 'NoneType' object has no attribute 'MANUAL'

Asyncio errors in bleak

Hi,

I do not know if this issue is related to some of the already open ones since I do not use eq3cli. However, the underlying issue could be the same.

Since the switch to bleak, I can no longer connect to my thermostats. I can simply reproduce the error by executing:

from eq3bt import Thermostat
test = Thermostat("00:1a:22:12:26:ee")
test.update()

The output is the following:

>>> from eq3bt import Thermostat

>>> test = Thermostat("00:1a:22:12:26:ee")

>>> test.update()
Task exception was never retrieved
future: <Task finished name='Task-9' coro=<BleakConnection.on_notification() done, defined at /home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/bleakconnection.py:77> exception=TypeError("unsupported operand type(s) for +: 'BleakGATTCharacteristicBlueZDBus' and 'int'")>
Traceback (most recent call last):
  File "/home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/bleakconnection.py", line 119, in make_request
    self._loop.run_until_complete(self.wait_for_response(timeout))
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/bleakconnection.py", line 101, in wait_for_response
    await asyncio.wait_for(self._notifyevent.wait(), timeout)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/usr/lib/python3.8/asyncio/locks.py", line 309, in wait
    await fut
RuntimeError: Task <Task pending name='Task-7' coro=<Event.wait() running at /usr/lib/python3.8/asyncio/locks.py:309> cb=[_release_waiter(<Future pendi...8e2f51700>()]>)() at /usr/lib/python3.8/asyncio/tasks.py:429]> got Future <Future pending> attached to a different loop

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/bleakconnection.py", line 80, in on_notification
    handle = handle + 1
TypeError: unsupported operand type(s) for +: 'BleakGATTCharacteristicBlueZDBus' and 'int'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/eq3btsmart.py", line 217, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/bleakconnection.py", line 119, in make_request
    self._loop.run_until_complete(self.wait_for_response(timeout))
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/sqall/syncfolder/projekte/alertR/thermostat_service/venv_bleak/lib/python3.8/site-packages/eq3bt/bleakconnection.py", line 101, in wait_for_response
    await asyncio.wait_for(self._notifyevent.wait(), timeout)
  File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/usr/lib/python3.8/asyncio/locks.py", line 309, in wait
    await fut
RuntimeError: Task <Task pending name='Task-7' coro=<Event.wait() running at /usr/lib/python3.8/asyncio/locks.py:309> cb=[_release_waiter(<Future pendi...8e2f51700>()]>)() at /usr/lib/python3.8/asyncio/tasks.py:429]> got Future <Future pending> attached to a different loop

I am running a xubuntu 20.04 machine with Python 3.8.10 (default, Jun 22 2022, 20:18:18) and have the following packages installed in my python environment:

Package       Version
------------- -------
async-timeout 4.0.2  
bleak         0.18.1 
click         8.1.3  
construct     2.10.68
dbus-fast     1.17.0 
pip           20.0.2 
pkg-resources 0.0.0  
python-eq3bt  0.2    
setuptools    44.0.0 
wheel         0.34.2

Everything works fine if I downgrade to version 0.1.12 which uses bluepy.

Well, since I thought this was a problem in bleak, I got involved in this issue hbldh/bleak#946 However, the maintainer says this is a problem in the asyncio loop of the python-eq3bt library (see here: hbldh/bleak#946 (comment) ).

Thanks!

running eq3cli with bleak backend keeps hanging

Hi,

I just tested the latest python-eq3bt version and found that eq3cli hangs whenever I use the bleak backend. Both bluepy and gattlib seem to be working fine though. Here are some log outputs:

--backend gattlib

$> eq3cli --debug --mac 00:1A:XX:XX:XX:XX --backend gattlib
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.gattlibconnection:Trying to connect to 00:1A:XX:XX:XX:XX
DEBUG:eq3bt.gattlibconnection:Connected to 00:1A:XX:XX:XX:XX
DEBUG:eq3bt.gattlibconnection:Writing b'0316091c170724' to 1041
DEBUG:eq3bt.gattlibconnection:Waiting for notifications for 1
DEBUG:eq3bt.gattlibconnection:Got notification from 1057: b'1b210402010900041c0000000018032a2207'
DEBUG:eq3bt.eq3btsmart:Received notification from the device..
DEBUG:eq3bt.eq3btsmart:Got status: b'02010900041c0000000018032a2207'
DEBUG:eq3bt.eq3btsmart:Parsed status: Container: 
    cmd = 2
    mode = Container: 
        AUTO = True
        MANUAL = True
        DST = True
    valve = 0
    target_temp = 14.0
    away = b'\x00\x00\x00\x00' (total 4)
    presets = Container: 
        window_open_temp = 12.0
        window_open_time = 0:15:00
        comfort_temp = 21.0
        eco_temp = 17.0
        offset = 0.0
DEBUG:eq3bt.eq3btsmart:Valve state:      0
DEBUG:eq3bt.eq3btsmart:Mode:             manual (14.0C) dst
DEBUG:eq3bt.eq3btsmart:Target temp:      14.0
DEBUG:eq3bt.eq3btsmart:Away end:         None
DEBUG:eq3bt.eq3btsmart:Window open temp: 12.0
DEBUG:eq3bt.eq3btsmart:Window open time: 0:15:00
DEBUG:eq3bt.eq3btsmart:Comfort temp:     21.0
DEBUG:eq3bt.eq3btsmart:Eco temp:         17.0
DEBUG:eq3bt.eq3btsmart:Temp offset:      0.0
[00:1A:XX:XX:XX:XX] Target 14.0 (mode: manual (14.0C) dst, away: no)
Locked: False
Batter low: False
Window open: False
Window open temp: 12.0
Window open time: 0:15:00
Boost: False
Current target temp: 14.0
Current comfort temp: 21.0
Current eco temp: 17.0
Current temp offset: 0.0
Current mode: manual (14.0C) dst
Valve: 0

--backend bluepy

$> eq3cli --debug --mac 00:1A:XX:XX:XX:XX --backend bluepy
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.connection:Trying to connect to 00:1A:XX:XX:XX:XX
DEBUG:eq3bt.connection:Connected to 00:1A:XX:XX:XX:XX
DEBUG:eq3bt.connection:Writing b'0316091c170807' to 1041 with with_response=True
DEBUG:eq3bt.connection:Waiting for notifications for 1
DEBUG:eq3bt.connection:Got notification from 1057: b'02010900041c0000000018032a2207'
DEBUG:eq3bt.eq3btsmart:Received notification from the device..
DEBUG:eq3bt.eq3btsmart:Got status: b'02010900041c0000000018032a2207'
DEBUG:eq3bt.eq3btsmart:Parsed status: Container: 
    cmd = 2
    mode = Container: 
        AUTO = True
        MANUAL = True
        DST = True
    valve = 0
    target_temp = 14.0
    away = b'\x00\x00\x00\x00' (total 4)
    presets = Container: 
        window_open_temp = 12.0
        window_open_time = 0:15:00
        comfort_temp = 21.0
        eco_temp = 17.0
        offset = 0.0
DEBUG:eq3bt.eq3btsmart:Valve state:      0
DEBUG:eq3bt.eq3btsmart:Mode:             manual (14.0C) dst
DEBUG:eq3bt.eq3btsmart:Target temp:      14.0
DEBUG:eq3bt.eq3btsmart:Away end:         None
DEBUG:eq3bt.eq3btsmart:Window open temp: 12.0
DEBUG:eq3bt.eq3btsmart:Window open time: 0:15:00
DEBUG:eq3bt.eq3btsmart:Comfort temp:     21.0
DEBUG:eq3bt.eq3btsmart:Eco temp:         17.0
DEBUG:eq3bt.eq3btsmart:Temp offset:      0.0
[00:1A:XX:XX:XX:XX] Target 14.0 (mode: manual (14.0C) dst, away: no)
Locked: False
Batter low: False
Window open: False
Window open temp: 12.0
Window open time: 0:15:00
Boost: False
Current target temp: 14.0
Current comfort temp: 21.0
Current eco temp: 17.0
Current temp offset: 0.0
Current mode: manual (14.0C) dst
Valve: 0

--backend bleak

$> eq3cli --debug --mac 00:1A:XX:XX:XX:XX --backend bleak
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.bleakconnection:Trying to connect to 00:1A:XX:XX:XX:XX

Is there any way I can debug this further? I am running bluez-5.65 on my host system (not in a container).

Set date/time

The misbehaviour on home-assistant/core#3885 makes me believe that thermostat date and time can be set over bluetooth. It would be nice to be able to sync date and time on the devices.

TypeError: subcon should be a Construct field

Error when calling the cli tool like this

~/eq3 $ eq3cli 
Traceback (most recent call last):
  File "/home/pi/eq3/bin/eq3cli", line 7, in <module>
    from eq3bt.eq3cli import cli
  File "/home/pi/eq3/lib/python3.5/site-packages/eq3bt/__init__.py", line 2, in <module>
    from .eq3btsmart import Thermostat, TemperatureException, Mode
  File "/home/pi/eq3/lib/python3.5/site-packages/eq3bt/eq3btsmart.py", line 17, in <module>
    from .structures import *
  File "/home/pi/eq3/lib/python3.5/site-packages/eq3bt/structures.py", line 79, in <module>
    "cmd" / Const(Int8ub, PROP_INFO_RETURN),
  File "/home/pi/eq3/lib/python3.5/site-packages/construct/core.py", line 1277, in __init__
    super(Const, self).__init__(subcon)
  File "/home/pi/eq3/lib/python3.5/site-packages/construct/core.py", line 287, in __init__
    raise TypeError("subcon should be a Construct field")
TypeError: subcon should be a Construct field

Is this a Python 3.5 related issue?

Failed to connect to peripheral

Hello,

I am trying to connect to a brand new eqiva eq3 thermostat.
The device is new, with full capacity batteries, installed a feet away from the computer I'm using to test connection.
I've configured the thermostat via android app, and it works correctly when connected.
But if I disconnect the thermostat from the phone and I try to read the device state via eq3cli, this is the output:

eq3cli --mac 00:xx:xx:xx:xx:0f --debug
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.connection:Trying to connect to 00:1a:22:13:9c:0f
DEBUG:eq3bt.connection:Unable to connect to the device 00:1a:22:13:9c:0f, retrying: Failed to connect to peripheral 00:1a:22:13:9c:0f, addr type: public
DEBUG:eq3bt.connection:Second connection try to 00:1a:22:13:9c:0f failed: Failed to connect to peripheral 00:1a:22:13:9c:0f, addr type: public
DEBUG:eq3bt.connection:Got exception from bluepy while making a request: Failed to connect to peripheral 00:1a:22:13:9c:0f, addr type: public
Traceback (most recent call last):
  File "/home/marco/.local/lib/python3.8/site-packages/eq3bt/connection.py", line 36, in __enter__
    self._conn.connect(self._mac)
  File "/home/marco/.local/lib/python3.8/site-packages/bluepy/btle.py", line 445, in connect
    self._connect(addr, addrType, iface)
  File "/home/marco/.local/lib/python3.8/site-packages/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 00:1a:22:13:9c:0f, addr type: public

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/marco/.local/bin/eq3cli", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/marco/.local/lib/python3.8/site-packages/eq3bt/eq3cli.py", line 34, in cli
    thermostat.update()
  File "/home/marco/.local/lib/python3.8/site-packages/eq3bt/eq3btsmart.py", line 205, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/home/marco/.local/lib/python3.8/site-packages/eq3bt/connection.py", line 71, in make_request
    with self:
  File "/home/marco/.local/lib/python3.8/site-packages/eq3bt/connection.py", line 40, in __enter__
    self._conn.connect(self._mac)
  File "/home/marco/.local/lib/python3.8/site-packages/bluepy/btle.py", line 445, in connect
    self._connect(addr, addrType, iface)
  File "/home/marco/.local/lib/python3.8/site-packages/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 00:1a:22:13:9c:0f, addr type: public

This is the environment I'm running commands in:

  • ubuntu 20.04
  • python 3.8
  • pip 20.0.2
  • python-eq3bt==0.1.11
  • bluepy==1.3.0

The goal is to add the thermostat to Home Assistant on a Raspberry Pi, but the same error occurs with the home assistant integration.

Is this library compatible with the latest eqiva firmware?

error in code when connection fails

I test the script and an error occurs vhen the connection fails.
Here are the logs
`Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/eq3bt/connection.py", line 36, in enter
self._conn.connect(self._mac)
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 455, in connect
self._connect(addr, addrType, iface)
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 447, in _connect
raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType) , rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 00:1A:22:0E:D0:FD, addr type: publi c

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./eq3cli", line 10, in
sys.exit(cli())
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1114, in invoke
return Command.invoke(self, ctx)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/eq3bt/eq3cli.py", line 34, in cli
thermostat.update()
File "/home/pi/.local/lib/python3.7/site-packages/eq3bt/eq3btsmart.py", line 205, in update
self._conn.make_request(PROP_WRITE_HANDLE, value)
File "/home/pi/.local/lib/python3.7/site-packages/eq3bt/connection.py", line 71, in make_request
with self:
File "/home/pi/.local/lib/python3.7/site-packages/eq3bt/connection.py", line 40, in enter
self._conn.connect(self._mac)
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 455, in connect
self._connect(addr, addrType, iface)
File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 447, in _connect
raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType) , rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 00:1A:22:0E:D0:FD, addr type: publi c
`
Can you modify the code to avoid this ?

I need some help understanding the ongoing issue with the Hassio/HA integration

Hey @rytilahti ,
thanks for your continous work on that library even tho you are not using it yourself anymore. I'm trying to wrap my head around why my thermostats are not working anymore in Homeassistant 2022.08, but it's such a rabbithole right now.

  • Your library (now v0.2?) is part of the HA Core, so everything I had to do last year, was adding some YAML lines and I got the "climate.living_room" thermostat (and three more) I could use for all the good stuff.
  • At some point it got borked because HA changed their way of handling BTLE-Devices with their new Integration and you added these two new backends plus their dependencies and this got also merged into core, right? home-assistant/core#75145
  • Then there is the fact that HA is moving away from they YAML-configs which borked it again. And you tried a fix home-assistant/core#74864 but hasn't been merged yet, because it's too much work right now, and also #59 which tries to just work around it by basically writing a new library than rewriting it?
  • home-assistant/core#76040 you suggested to move to a bt-mqtt-gateway as a workaround here but I am not sure if this is still a thing with the issues right now.

Could you provide a timeline of the events and/or give a hint on how to help you out exactly? And do you have a clue on what HA-Version it broke so I could in the worst event downgrade to that version? Thank you very very much!!!

best regards,
Kay

Helper wasn't build

https://hastebin.com/olunadaged.sql

The bluepy library didn't build the Helper

(since we chatted in Gitter and this was the wrong error, I'll paste you the other errors in here aswell in the right order)
#1 https://hastebin.com/gebavefili.sql
#2 https://hastebin.com/fuwafabefi.sql
#3 https://hastebin.com/wininoxike.sql
#4 https://hastebin.com/uzokibedob.sql
#5 https://hastebin.com/cujosihofi.sql
#6 https://hastebin.com/jetezuliso.sql
#7 would be the one from above: https://hastebin.com/olunadaged.sql

Time zone awareness

Iโ€™m using eq3bt with home assistant. Home assistant has been using UTC time internally since 2015, and hassbian is also pre-configured for UTC. There is no way to pass a time zone in to eq3bt as far as I can tell, so the times are off by the TZ difference (in my case, UTC vs CEST = 2 hours). Home Assistant configures a time zone and handles time zones correctly internally, but as it cannot pass that data to eq3bt, the thermostats get the system time (which is in UTC). As a result, all programmed schedules are off.

All methods using datetime.now would need to be extended to take a time zone parameter, or time zone could be made global. The callers need to pass in a time zone. If none is given, system timezone could still be used, but a warning should probably be given to the user.

TypeError: subcon should be a Construct field

The following exception is raised on a Raspberry Pi 3 during the initial import of the library.

Traceback (most recent call last):
  File "bt-window.py", line 2, in <module>
    from eq3bt import Thermostat
  File "/usr/local/lib/python2.7/dist-packages/eq3bt/__init__.py", line 2, in <module>
    from .eq3btsmart import Thermostat, TemperatureException, Mode
  File "/usr/local/lib/python2.7/dist-packages/eq3bt/eq3btsmart.py", line 17, in <module>
    from .structures import *
  File "/usr/local/lib/python2.7/dist-packages/eq3bt/structures.py", line 79, in <module>
    "cmd" / Const(Int8ub, PROP_INFO_RETURN),
  File "/usr/local/lib/python2.7/dist-packages/construct/core.py", line 1277, in __init__
    super(Const, self).__init__(subcon)
  File "/usr/local/lib/python2.7/dist-packages/construct/core.py", line 287, in __init__
    raise TypeError("subcon should be a Construct field")
TypeError: subcon should be a Construct field

Change requirements for construct

After the change of the construct api the requirements should be adapted, because for example it won't work with an installed construct 2.8.10.
But I don't now the lowest version of construct that works maybe 2.9.0?

Use gattlib by default (for Home Assistant)

Hi rytilahti,

due to Home Assistant's upgrade to Python 3.10, it does not support bluepy anymore. Since python-eq3bt does support gattlib, using gattlib by default and bluepy optionally should make python-eq3bt work with Home Assistant again.
Would switching the dependencies and publishing a new version be ok with you? If so, I can prepare a pull request.

Thanks!

Subsequent connects fail

Should I disconnect from the device between update calls, I am using this great library using Python on Pi and am retrieving a status from a server and setting the device accordingly. It connects and works on the first pass, but subsequent calls seem to fail. It seems to be working asynchronously, can you point me to how we can monitor the connection status so as to wait until connection is in place. Also, is there a disconnection method to free up the EQ3?

It is an amazing library and really thankful for the work you have put into it.

Thanks

Python 2 support?

Hi,
project works pretty well on python 3, but on python 2 I dont get any feedback from the device. Also I didnt get any exceptions which could be syntax problems. Basic code like this, doesnt work:
`>>> from eq3bt import Thermostat

th = Thermostat("XX:XX:XX:XX:XX:XX")
th.update()
th.target_temperature
<Mode.Unknown: -1>`
Thanks anyway!

FileNotFoundError: [Errno 2] No such file or directory

Hello, I can't resolve following issue:

bash-5.1# eq3cli --mac='5C:E5:0C:B0:EF:88'
Traceback (most recent call last):
  File "/usr/local/bin/eq3cli", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke
    rv = super().invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/eq3bt/eq3cli.py", line 47, in cli
    thermostat.update()
  File "/usr/local/lib/python3.10/site-packages/eq3bt/eq3btsmart.py", line 217, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/usr/local/lib/python3.10/site-packages/eq3bt/bleakconnection.py", line 106, in make_request
    with self:
  File "/usr/local/lib/python3.10/site-packages/eq3bt/bleakconnection.py", line 51, in __enter__
    self._loop.run_until_complete(self._conn.connect())
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 107, in connect
    device = await BleakScannerBlueZDBus.find_device_by_address(
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 221, in find_device_by_address
    return await cls.find_device_by_filter(
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 250, in find_device_by_filter
    async with cls(detection_callback=apply_filter, **kwargs):
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 96, in __aenter__
    await self.start()
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 128, in start
    manager = await get_global_bluez_manager()
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 812, in get_global_bluez_manager
    await instance.async_init()
  File "/usr/local/lib/python3.10/site-packages/bleak/backends/bluezdbus/manager.py", line 294, in async_init
    bus = MessageBus(bus_type=BusType.SYSTEM)
  File "/usr/local/lib/python3.10/site-packages/dbus_next/aio/message_bus.py", line 122, in __init__
    super().__init__(bus_address, bus_type, ProxyObject)
  File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 85, in __init__
    self._setup_socket()
  File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 575, in _setup_socket
    raise err
  File "/usr/local/lib/python3.10/site-packages/dbus_next/message_bus.py", line 548, in _setup_socket
    self._sock.connect(filename)
FileNotFoundError: [Errno 2] No such file or directory
bash-5.1#

bash-5.1# pip install --upgrade python-eq3bt
Requirement already satisfied: python-eq3bt in /usr/local/lib/python3.10/site-packages (0.2)
Requirement already satisfied: bleak in /usr/local/lib/python3.10/site-packages (from python-eq3bt) (0.15.1)
Requirement already satisfied: click in /usr/local/lib/python3.10/site-packages (from python-eq3bt) (8.1.3)
Requirement already satisfied: construct in /usr/local/lib/python3.10/site-packages (from python-eq3bt) (2.10.56)
Requirement already satisfied: typing-extensions>=4.2.0 in /usr/local/lib/python3.10/site-packages (from bleak->python-eq3bt) (4.3.0)
Requirement already satisfied: dbus-next in /usr/local/lib/python3.10/site-packages (from bleak->python-eq3bt) (0.2.3)

BleakDBusError: Operation failed with ATT error: 0x0e (Connection Rejected

Hey there not sure what is happening with the new release 0.2. I tried it because I use eq3 on home assistant.

pi@VpnPi:~ $ eq3cli
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/eq3bt/bleakconnection.py", line 106, in make_request
    with self:
  File "/home/pi/.local/lib/python3.9/site-packages/eq3bt/bleakconnection.py", line 65, in __enter__
    self._loop.run_until_complete(
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 931, in start_no                                                     tify
    assert_reply(reply)
  File "/home/pi/.local/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_rep                                                     ly
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Connection Rejected                                                      Due To Security Reasons)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/.local/bin/eq3cli", line 8, in <module>
    sys.exit(cli())
  File "/home/pi/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python3.9/site-packages/click/core.py", line 1635, in invoke
    rv = super().invoke(ctx)
  File "/home/pi/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/pi/.local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/pi/.local/lib/python3.9/site-packages/eq3bt/eq3cli.py", line 47, in cli
    thermostat.update()
  File "/home/pi/.local/lib/python3.9/site-packages/eq3bt/eq3btsmart.py", line 217, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/home/pi/.local/lib/python3.9/site-packages/eq3bt/bleakconnection.py", line 123, in make_request
    raise BackendException("Exception on write using bleak") from ex
eq3bt.BackendException: Exception on write using bleak

Anyone knows what is happening here?

Crash under python <3.10: got Future <Future pending> attached to a different loop

Using Dockerfile:

FROM python:3.9

WORKDIR /app
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y bluez bluetooth

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
ENV PATH="${PATH}:/root/.poetry/bin"

COPY . .
RUN poetry install

ENTRYPOINT ["poetry", "run", "eq3cli"]

executing the cli crashes on an eventloop related issue:

โฏ docker run -v /var/run/dbus/:/var/run/dbus/:z eq3bt:latest --mac 00:1A:22:xx --debug
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.bleakconnection:Trying to connect to 00:1A:22:xx
DEBUG:eq3bt.bleakconnection:Connected to 00:1A:22:xx
DEBUG:eq3bt.bleakconnection:Writing b'0316071311051f' to 1041
DEBUG:eq3bt.bleakconnection:Waiting for notifications for 1
DEBUG:eq3bt.bleakconnection:Got notification from 1057: b'020189000409'
DEBUG:eq3bt.eq3btsmart:Received notification from the device..
DEBUG:eq3bt.eq3btsmart:Got status: b'020189000409'
DEBUG:eq3bt.eq3btsmart:Parsed status: Container: 
    cmd = 2
    mode = Container: 
        AUTO = True
        MANUAL = True
        DST = True
        LOW_BATTERY = True
    valve = 0
    target_temp = 4.5
    away = None
    presets = None
DEBUG:eq3bt.eq3btsmart:Valve state:      0
DEBUG:eq3bt.eq3btsmart:Mode:             manual off dst low battery
DEBUG:eq3bt.eq3btsmart:Target temp:      4.5
DEBUG:eq3bt.eq3btsmart:Away end:         None
DEBUG:eq3bt.eq3btsmart:Window open temp: None
DEBUG:eq3bt.eq3btsmart:Window open time: None
DEBUG:eq3bt.eq3btsmart:Comfort temp:     None
DEBUG:eq3bt.eq3btsmart:Eco temp:         None
DEBUG:eq3bt.eq3btsmart:Temp offset:      None
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/.cache/pypoetry/virtualenvs/python-eq3bt-9TtSrW0h-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/python-eq3bt-9TtSrW0h-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/root/.cache/pypoetry/virtualenvs/python-eq3bt-9TtSrW0h-py3.9/lib/python3.9/site-packages/click/core.py", line 1635, in invoke
    rv = super().invoke(ctx)
  File "/root/.cache/pypoetry/virtualenvs/python-eq3bt-9TtSrW0h-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.cache/pypoetry/virtualenvs/python-eq3bt-9TtSrW0h-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/root/.cache/pypoetry/virtualenvs/python-eq3bt-9TtSrW0h-py3.9/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/eq3bt/eq3cli.py", line 47, in cli
    thermostat.update()
  File "/app/eq3bt/eq3btsmart.py", line 217, in update
    self._conn.make_request(PROP_WRITE_HANDLE, value)
  File "/app/eq3bt/bleakconnection.py", line 119, in make_request
    self._loop.run_until_complete(self.wait_for_response(timeout))
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/app/eq3bt/bleakconnection.py", line 101, in wait_for_response
    await asyncio.wait_for(self._notifyevent.wait(), timeout)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.9/asyncio/locks.py", line 226, in wait
    await fut
RuntimeError: Task <Task pending name='Task-9' coro=<Event.wait() running at /usr/local/lib/python3.9/asyncio/locks.py:226> cb=[_release_waiter(<Future pendi...7e95b6640>()]>)() at /usr/local/lib/python3.9/asyncio/tasks.py:416]> got Future <Future pending> attached to a different loop

signed releases

Hey there. I've just updated the AUR package to your latest version.

While doing so, I saw releases are not signed yet.
I'd really appreciate if you considered changing this for upcoming releases.

The Debian maintainers put up a handy guide on how this might become an easy but worthwhile addition to your release process.
https://wiki.debian.org/Creating signed GitHub releases

That way GitHub is not able to change your released package contents without everybody noticing.
A trait that would be appreciated in distribution.

Other than that I really liked the project before and even more now that you cleaned and refactored the codebase so much to suit modern standards. Thanks for your work!

Question / Not an issue

Hello,
anyone have an idea how come it works without any pairing? The device is paired to my phone but it successfully works from the home-assistant and it can even change settings. Any idea how the access can be restricted? Thanks.

AttributeError: 'NoneType' object has no attribute 'MANUAL'

I've this problem when i connect to my EQ3. I'm running the latest version 0.1.10 in Homeassistant Env.

Traceback (most recent call last):
  File "/srv/homeassistant/bin/eq3cli", line 10, in <module>
    sys.exit(cli())
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/eq3bt/eq3cli.py", line 38, in cli
    ctx.invoke(state)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/eq3bt/eq3cli.py", line 160, in state
    click.echo(dev)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/utils.py", line 222, in echo
    message = text_type(message)
  File "/srv/homeassistant/lib/python3.5/site-packages/eq3bt/eq3btsmart.py", line 97, in __str__
    self.mode_readable,
  File "/srv/homeassistant/lib/python3.5/site-packages/eq3bt/eq3btsmart.py", line 265, in mode_readable
    if mode.MANUAL:
AttributeError: 'NoneType' object has no attribute 'MANUAL'

from Construct developer, a note

I am the developer of Construct (a parsing library) since I took over the project 2 years ago. Please refer any other projects that also use this library to this post, or copy it over to them.

Construct is undergoing heavy changes at the moment, similar to those between 2.5->2.8, including addition of compiler feature (to make it much faster than Kaitai), but also several classes are going to be removed (for a good reason), and also few were added. API will be unstable for about a month.

What you can do:

  • All scheduled work is posted as tickets, in Issues and also on Kanban page. If you subscribe (watch repository) then you will have advance notice of any incoming changes. Unfortunately those tickets also include minor work items, so you would get some clutter notifications too. I appologise for that.
  • I encourage everyone to browse those tickets, vote for feature requests, but also post objections for planned removal of features, or changes in semantics. Subscribing therefore is recommended.
  • You can find what was already changed (at any moment) on Transition page, which is like a growing changelog. It gets updated whenever something gets added or removed, but since the order is not chronological, new items do not end up on top or bottom of the list.
  • You can find currently available classes and semantics on revamped Core API pages. Those pages are very extensive and always uptodate with the implementation.
  • Feel free, at any point in time, to open a new Issue and ask questions or make complaints about breakage. At minimum, I can offer advice and possible alternatives. People very often use the classes in ways that were not designed for, like use String classes to process Bytes.
  • Feel free, at any point in time, to open a new Issue and request changes. If you need a new class, and make a good clear case, I would be more than willing to add it to core library to support your project.
  • API should be stable within a month, so either do version pinning and deal with it then, or keep fixing your code at every release (which is ~3 day cycle at the moment).

Close this topic at your discretion.

[Errno 13] Permission denied running with root

I am having problems to use this library.
I am using python 3.5 version. Installed the library

root@TrastoRaspberry:/ pip3 install python-eq3bt
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: python-eq3bt in /usr/local/lib/python3.5/dist-packages (0.1.11)
Requirement already satisfied: click in /usr/local/lib/python3.5/dist-packages (from python-eq3bt) (7.1.2)
Requirement already satisfied: click-datetime in /usr/local/lib/python3.5/dist-packages (from python-eq3bt) (0.2)
Requirement already satisfied: construct in /usr/local/lib/python3.5/dist-packages (from python-eq3bt) (2.10.54)
Requirement already satisfied: bluepy>=1.0.5 in /usr/local/lib/python3.5/dist-packages (from python-eq3bt) (1.3.0)
Requirement already satisfied: click in /usr/local/lib/python3.5/dist-packages (from python-eq3bt) (7.1.2)

But when I try to use the library...

root@TrastoRaspberry:/home/dani# eq3cli --debug --mac 00:1A:22:16:8D:94 DEBUG:eq3bt.eq3btsmart:Querying the device.. DEBUG:eq3bt.connection:Trying to connect to 00:1A:22:16:8D:94 Traceback (most recent call last): File "/usr/local/bin/eq3cli", line 11, in <module> sys.exit(cli()) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1236, in invoke return Command.invoke(self, ctx) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/eq3bt/eq3cli.py", line 34, in cli thermostat.update() File "/usr/local/lib/python3.5/dist-packages/eq3bt/eq3btsmart.py", line 205, in update self._conn.make_request(PROP_WRITE_HANDLE, value) File "/usr/local/lib/python3.5/dist-packages/eq3bt/connection.py", line 71, in make_request with self: File "/usr/local/lib/python3.5/dist-packages/eq3bt/connection.py", line 36, in __enter__ self._conn.connect(self._mac) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 445, in connect self._connect(addr, addrType, iface) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 426, in _connect self._startHelper(iface) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 284, in _startHelper preexec_fn = preexec_function) File "/usr/lib/python3.5/subprocess.py", line 676, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child raise child_exception_type(errno_num, err_msg) PermissionError: [Errno 13] Permission denied

Can anybody help me to find the solution? I have been able to connect with the thermostat using a different library based on bluetoothctl without problems, but I prefer the Python alternative.

Changing mode not having any effect

The call to thermostat.set_mode(Mode.Manual) does not seem to have any effect for me. The temperature get's set to 10C, but the mode remains in auto.

The reverse works, if I'm in manual and call thermostat.set_mode(Mode.Auto), the mode is set correctly.

I'm on the newest eq3 firmware and using eq3bt==0.2

any idea whats going on?

Failed to install due to bluepy-helper compilation issue

I am running a clean install of Hassbian (Home Assistant OS) on a RaspberryPi 3. The command

pip install python-eq3bt

fails when "Running setup.py install for bluepy" with the message

Working dir is /tmp/pip-build-x6ukhfdf/bluepy
execute make -C ./bluepy clean
execute make -C bluepy -j1
Failed to compile bluepy-helper. Exiting install.
Command was 'make -C bluepy -j1' in /tmp/pip-build-x6ukhfdf/bluepy
Return code was 2

I tried the installation with pip as well as pip3 (and sudo).

Any idea how to fix that?
Thanks in advance

TypeError: locked() got multiple values for argument 'target'

Hi there,

thanks for taking your time to implement and publish this library. Unfortunately, I can't quite get it to work for my system. I'm using these models, but when trying to connect, I get the following output:

# eq3cli --mac 00:1A:22:06:XX:XX --debug
DEBUG:eq3bt.eq3btsmart:Querying the device..
DEBUG:eq3bt.connection:Trying to connect to 00:1A:22:06:XX:XX
DEBUG:eq3bt.connection:Connected to 00:1A:22:06:XX:XX
DEBUG:eq3bt.connection:Writing b'03120a030a151e' to 1041 with with_response=True
DEBUG:eq3bt.connection:Waiting for notifications for 1
DEBUG:eq3bt.connection:Got notification from 1057: b'020108000427'
DEBUG:eq3bt.eq3btsmart:Received notification from the device..
DEBUG:eq3bt.eq3btsmart:Got status: b'020108000427'
DEBUG:eq3bt.eq3btsmart:Parsed status: Container:
    cmd = 2
    mode = Container:
        DST = True
    valve = 0
    target_temp = 19.5
    away = b'' (total 0)
DEBUG:eq3bt.eq3btsmart:Valve state: 0
DEBUG:eq3bt.eq3btsmart:Mode:        auto dst
DEBUG:eq3bt.eq3btsmart:Target temp: 19.5
DEBUG:eq3bt.eq3btsmart:Away end:    None
[00:1A:22:06:12:03] Target 19.5 (mode: auto dst, away: no)
Traceback (most recent call last):
  File "/home/homeassistant/bin/eq3cli", line 11, in <module>
    sys.exit(cli())
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/eq3bt/eq3cli.py", line 38, in cli
    ctx.invoke(state)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/eq3bt/eq3cli.py", line 161, in state
    ctx.invoke(locked, ctx)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/homeassistant/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
TypeError: locked() got multiple values for argument 'target'

For me, it looks like it is able to connect, since it returns correct information (target_temp, etc.), and I can use some other commands like "temp", but there seems to be an incompatibility somewhere. Sadly, I don't know much about python, so I'm a bit lost here.

Any help is much appreciated!

Thanks

Karim

TypeError: locked() got multiple values for argument 'target'

This problem is show when i connect to my device and show me this stacktrace.

[DEVICE-MAC] Target 16.0 (mode: auto dst, away: no)
Traceback (most recent call last):
  File "/srv/homeassistant/bin/eq3cli", line 10, in <module>
    sys.exit(cli())
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/eq3bt/eq3cli.py", line 38, in cli
    ctx.invoke(state)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/eq3bt/eq3cli.py", line 161, in state
    ctx.invoke(locked, ctx)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
TypeError: locked() got multiple values for argument 'target'

Setting schedule

Many thanks for this. Having this control over the valves is great.

Would it be possible to get an example of usage for setting a schedule for a given day using the set_schedule method. I'm not sure what needs to be passed to the data parameter.

Keep connection alive

Hi,

have your tried to connect to eq3bt only once and keep the connection alive? I don't think that it would drain the battery too much. Would you mind adding such a functionality to python-eq3bt?

Power usage in raw GATT comms vs using BLE services?

Beautiful library! Using it to push EQ3BT state to MQTT (and subsequently couple this to OpenHAB). Thank you for the development.
I am currently polling the Valve state every 10 minutes, and activating my central boiler based on this. This means the system takes some time to respond to changes. I could poll more frequently, but I am worried about battery usage of the EQ3BT.

If I understand correctly, the library currently connects to the device via GATT and sends raw requests. It connects and disconnects each time. There is also the possibility to connect to the Eq3bt BLE services (NOTIFY, WRITE) and get data that way. See https://gist.github.com/jannau/2e77b4379f6a0bacc7f518080ae4aee7

Has the author ever considered this alternative method of communicating? Does the thermostat ever advertise e.g. valve state changes, or is polling definitely required? Would battery usage be improved?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.