New bluetooth thermostats (climate) component

Hi,

thanks to some helpful guy who figured out most of the protocol I was able to develop a new component for my Comet Blue thermostats. I’ve put it here for now: https://github.com/seidler2547/home-assistant-cc/blob/master/custom_components/climate/sygonix.py

I have tried pygattlib and pybatt and found neither of them very reliable. Whereas bluepy works like a charm, no problems yet.

I am new to the whole ecosystem, so let me say that this works very reliably but it probably needs some review/improvement/suggestions by someone who known what they’re doing (i.e. not me).

Stefan

1 Like

You will probably be asked to put most of that stuff into a library, like https://github.com/rytilahti/python-eq3bt or https://github.com/bimbar/bluepy_devices .

@seidler Hey, have you made any progress on the matter? I got myself a couple of Comet Blue / SilverCrest thermostats as well, with the sole intention of integrating them to HA – only to find out, you have already laid ground work.

Updated github with the code I currently use. It uses a BTLE to MQTT bridge I wrote.

Hi,
i would like to integrate my Eurotronic Comet Blues to Homeassistant, is there an tutorial?

@seidler:

Thank you very much. Thx to your new Code and the Code for the MQTT to BLE Bridge, I finaly got my “Thermy” Themostats bought from ALDI to work :slight_smile:

Vielen Dank aus Baden-Württemberg :smiley:

1 Like

Any news on this? Is there an component?

Can you elaborate on how you achieved this?

1 Like

so, let me see if I can recall it from my Memory:

  1. Install MQTT Broker “mosquitto” on the Computer running homeassistant. (I use a RPi for that matter -> apt install mosquitto). Start that Service.
  2. Enable the MQTT Component in your homeassistant configuration. (mqtt: broker 127.0.0.1)
  3. copy the custom component (https://github.com/seidler2547/home-assistant-cc/tree/master/custom_components/climate/sygonix.py) to the following folder: .homeassistant/custom_components/climate/
  4. create a new virtual Python Enviroment for the “blq-mqtt-bridge” with root user. The Component has to run with root priviledges for Bluetooth Access and scanning. (https://github.com/seidler2547/ble-mqtt-bridge). Afterwards start the ble-mqtt-bridge in that virtual python enviroment and let it run in the background.
  5. Insert your Thermostats into the configuration.yaml of homeassistant:
    • platform: sygonix
      devices:
      Room01:
      mac: ‘AA:BB:CC:DD:EE.FF’
      pin: ‘123456’ (The default PIN is ‘000000’)

You can search via “hcitool lescan” as root user for Bluetooth MAC Addresses of the Thermostats.

Restart the homeassistant service… This should do the Trick if I remember correctly.

Thanks, yes, that’s roughly it. In the virtualenv I think you need to install paho-mqtt and bluepy?

mosquitto is needed because the built-in HA broker does not support wildcards correctly.

You can use a random PIN, if the thermostat is in factory default state, it has PIN 000000 so the component will try that and then change the PIN to the one defined in the HA config (but only when HA starts up). It will also set the date and time, so no need to bother with that.

Hi,

yesterday i saw that in Germany LIDL will be offering Silvercrest thermostats for 25eu. These thermostats should be relabeled Homematic IP-thermostats.
I’d don’t know anything about integrating such thermostats in hassio but like to ask, if they will work with home assistant. Do i need the homematic base to get them working? Or is it possible to emulate this base with ha? Thanks in advance :slight_smile:

Homematic IP is not bluetooth, so not related to this component. But I think Homematic is supported in Home Assistant, so should be able to make them work.

Hi and thanks for the great work already done here!

I managed to install and run every installed package but the last step in linuxdrivers list doesn’t work for me:

I added in the configuration.yaml:

climate:
platform: sygonix
devices:
Bad:
mac: ‘80:30:dc:e8:fd:c4’
pin: ‘000000’

but I only get the following error:

Invalid config for [climate.sygonix]: expected a dictionary for dictionary value @ data[‘devices’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/climate.sygonix/

did you insert a string here to make it work?

I have the same thermostat as dynamo30 (Comet Blue), I succesfully connected to the thermostat already via the cometblue script (https://github.com/im-0/cometblue) but I want to include it in Home Assistant

EDIT:

Solved it by learning basic yaml syntax :wink:
I added 2 spaces before “Bad:” and 4 spaces befor “mac:” and “pin:”

Right, I was thinking the yaml doesn’t look right. It should look like this:

climate:
  - platform: sygonix
    devices:
      'Schlafzimmer':
        mac: 'E0:E5:CF:12:34:56'
        pin: 345753
      'Küche':
        mac: 'D0:B5:C2:67:89:AB'
        pin: 752246

Don’t use PIN 000000 unless you would want other people to mess with your thermostats :wink:
If the current PIN is 000000 (factory default) then it will be set to the PIN you specify in the configuration when HA first communicates with the device.

Getting other values from the component into states is a bit of work because of the way HA works. You need to use template sensors:

sensor:
  - platform: template
    sensors:
      temp_kuche:
        friendly_name: "Temperatur Küche"
        value_template: "{{ state_attr('climate.kuche', 'current_temperature')|float }}"
        unit_of_measurement: '°C'
        entity_id: climate.kuche
      batterie_kuche:
        friendly_name: 'Batterie Küche'
        value_template: '{{ state_attr('climate.kuche', 'battery_level')|int }}'
        unit_of_measurement: '%'
        entity_id: climate.kuche

The temperature sensor also allows you to get the temperature displayed in Lovelace.

I have installed hassio on the raspberry 3 with the sygonix.py located in the custom_components\climate folder.
unfortunately I not able to confirm that BT comunication is up ad running between HA and sygonix.

config validation done with possitive results so I assume that confiurations.yaml is fine.
current entries are image

where can I check the status of the BT connection?

Did you start the BLE-MQTT bridge as root? If it’s started and working these null values should become filled one by one.

negative. I don’t start it, it’s a point.
I am puzzled how to “create a new virtual Python Enviroment for the “blq-mqtt-bridge” with root user” in hassio

Right, I think this should work (I only tested on Debian though):

apt install libbluetooth-dev libc6-dev libglib2.0-dev python3-virtualenv python3-pip virtualenv
cd /opt
virtualenv -p python3 mqtt-ble-bridge
cd mqtt-ble-bridge
bin/pip3 install paho-mqtt bluepy

and then download the bridge into /opt/mqtt-ble-bridge either just by downloading it or by using git.
Finally, start it:

/opt/mqtt-ble-bridge/bin/python3 /opt/mqtt-ble-bridge/ble-mqtt-bridge.py

I have a problem with this component. When I change temperature on thermostat it’s not updated in HA and value of current temperature is wrong - 64 degrees.

@Piwek,
I had +64 degrees (sometimes), most of the time right after I started the BLE-> mqtt - bridge, for just a short time only. I applied a ‘dirty’ fix in Sygonix.py to filter this out. (But I believe the real issue is with the BLE->mqtt-bridge…) Under line 191 (elif handle == UUID_TEMP:) I added:
if float(data[0])<128:
self.temperature = float(data[0])/2.0

If your measured temperature is constantly 64 degrees, above will not help obviously…

For the set value;
I noticed it takes some time before the set value is finally read back into HA, even 30 sec or longer. So whenever you change the set value, it could be reverted to previous set value withing a few seconds, you would think it doesn’t work. But eventually (30 sec later) HA received the updated value (read from thermostat) and the value you changed to is displayed. Actually, in a rear case it indeed does not adopt the set value at first attempt.

Another hint; HA 0.88.1 is now telling to change custom_components naming, should be “custom_components\sygonix\climate.py”, not “custom_components\climate\sygonix.py”.