Danfoss Eco bluetooth valve thermostat

hi. and thank you very much for responding. well.

i am using hassio on a older dell desktop PC

  1. from my own logic i have found that the bluetooth link must be working because i can retrieve the mac adress and the key.

  2. i am not too sure if i have it all setup correctly. from the log etrv2mqtt it tells me i am connected to mqtt.
    this is the full log etrv2mqtt log - Pastebin.com

  3. i am not 100% sure if i have the correct values in the configurations.
    here is my setup (think i got what is important) danfoss hassio setup - Pastebin.com

  4. general error log gives me a great deal of errors. but i think they are related to the fact that i am unable to retrieve any data from the danfos device hassio errors - Pastebin.com

i was wondering if you are using raspberry pi 4 with built in bluetooth ?

by the way. i did skip this step

sudo apt install bluez-tools bluez bluez-firmware bluez-hcidump pi-bluetooth

because it is not installed on a raspberry pi. perhaps that is the issue.

i am now trying to install it. but im pretty sure it is not possible because “apt” is not installed on this build.

(currently creating backup)

Hi Jacob,

In the etrv2mqtt log: it connects to the MQTT server but fails on trying to connect to the thermostat

2021-08-18 16:48:16.275 | DEBUG    | libetrv.device:connect:54 - Trying connect to 00:04:2f:94:95:5b
2021-08-18 16:48:23.206 | ERROR    | libetrv.device:connect:68 - Unable connect to 00:04:2f:94:95:5b. Retrying in 100ms
2021-08-18 16:48:35.047 | DEBUG    | libetrv.device:send_pin:87 - Write PIN to 00:04:2f:94:95:5b
2021-08-18 16:48:35.245 | ERROR    | __main__:<module>:8 - An error has been caught in function '<module>', process 'MainProcess' (7), thread 'MainThread' (139827098076992):
Traceback (most recent call last):

I am not sure but I guess it uses Bluetooth to poll the device.

In the main log I can see you have errors related to all your Danfoss sensors but with the same reason like this

2021-08-17 23:11:41 ERROR (MainThread) [homeassistant.components.climate] Platform mqtt does not generate unique IDs. ID 00_04_2f_94_95_5b_thermostat already exists - ignoring climate.sovevaerelse_thermostat

So this looks like something wrong with the generated mqtt messages.

Regarding configuration:
I had earlier that mqt section in my configuration.yaml but I commented this out, it is not necessary.

Another difference is that in my Mosquitto broker config, I have an additional option:

anonymous: true

But I don’ think this causes your errors.

Please check the mqtt log maybe it reports more relevant details.

Also enable debug logging of the mqqt messages into the general log, by adding the following lines to your configuration.yaml

logger:
  default: info
  logs:
    homeassistant.components.mqtt: debug

Then we will be able to see details of the received messages. like the following from my log:

2021-08-19 23:08:50 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/etrv/00_04_2f_4E_B8_30_rep_name/config (retained): b'{"name": "danfossstue Reported name", "unique_id": "00_04_2f_4E_B8_30_reported_name", "state_topic": "etrv/danfossstue/state", "value_template": "{{ value_json.name }}", "device": {"identifiers": "00:04:2f:4E:B8:30", "manufacturer": "Danfoss", "model": "eTRV", "name": "danfossstue"}, "availability_topic": "etrv/state", "payload_available": "online", "payload_not_available": "offline"}'

this might help us figure out why they are not considered unique.

i get a ton of log from the mqtt. but it does still not seem to work.
my bluetooth reciever is located with a pretty weak signal. (from the scan its RSSI=-81dB)

2021-08-19 23:48:36 INFO (MainThread) [custom_components.hacs] Stage changed: HacsStage.RUNNING
2021-08-19 23:49:37 INFO (MainThread) [homeassistant.components.websocket_api.http.connection] [140003244909760] Connection closed by client
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on etrv/state: b'online'
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/climate/etrv/00_04_2f_94_95_5b_thermostat/config: b'{"~": "etrv/bedroom", "name": "bedroom Thermostat", "unique_id": "00_04_2f_94_95_5b_thermostat", "temp_cmd_t": "~/set", "temp_stat_t": "~/state", "temp_stat_tpl": "{{ value_json.set_point }}", "curr_temp_t": "~/state", "curr_temp_tpl": "{{ value_json.room_temp }}", "min_temp": "10", "max_temp": "40", "temp_step": "0.5", "modes": ["heat"], "send_if_off": true, "device": {"identifiers": "00:04:2f:94:95:5b", "manufacturer": "Danfoss", "model": "eTRV", "name": "bedroom"}, "availability_topic": "etrv/state", "payload_available": "online", "payload_not_available": "offline"}'
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'bedroom Thermostat', 'unique_id': '00_04_2f_94_95_5b_thermostat', 'temperature_command_topic': 'etrv/bedroom/set', 'temperature_state_topic': 'etrv/bedroom/state', 'temperature_state_template': '{{ value_json.set_point }}', 'current_temperature_topic': 'etrv/bedroom/state', 'current_temperature_template': '{{ value_json.room_temp }}', 'min_temp': '10', 'max_temp': '40', 'temp_step': '0.5', 'modes': ['heat'], 'send_if_off': True, 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: climate etrv 00_04_2f_94_95_5b_thermostat, sending update
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('climate', 'etrv 00_04_2f_94_95_5b_thermostat') '{'name': 'bedroom Thermostat', 'unique_id': '00_04_2f_94_95_5b_thermostat', 'temperature_command_topic': 'etrv/bedroom/set', 'temperature_state_topic': 'etrv/bedroom/state', 'temperature_state_template': '{{ value_json.set_point }}', 'current_temperature_topic': 'etrv/bedroom/state', 'current_temperature_template': '{{ value_json.room_temp }}', 'min_temp': '10', 'max_temp': '40', 'temp_step': '0.5', 'modes': ['heat'], 'send_if_off': True, 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}'
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: climate.sovevaerelse_thermostat
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/etrv/00_04_2f_94_95_5b_battery/config: b'{"device_class": "battery", "name": "bedroom Battery", "unique_id": "00_04_2f_94_95_5b_battery", "state_topic": "etrv/bedroom/state", "value_template": "{{ value_json.battery }}", "unit_of_measurement": "%", "device": {"identifiers": "00:04:2f:94:95:5b", "manufacturer": "Danfoss", "model": "eTRV", "name": "bedroom"}, "availability_topic": "etrv/state", "payload_available": "online", "payload_not_available": "offline"}'
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/etrv/00_04_2f_94_95_5b_rep_name/config: b'{"name": "bedroom Reported name", "unique_id": "00_04_2f_94_95_5b_reported_name", "state_topic": "etrv/bedroom/state", "value_template": "{{ value_json.name }}", "device": {"identifiers": "00:04:2f:94:95:5b", "manufacturer": "Danfoss", "model": "eTRV", "name": "bedroom"}, "availability_topic": "etrv/state", "payload_available": "online", "payload_not_available": "offline"}'
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/etrv/00_04_2f_94_95_5b_temperature/config: b'{"device_class": "temperature", "name": "bedroom Temperature", "unique_id": "00_04_2f_94_95_5b_temperature", "state_topic": "etrv/bedroom/state", "value_template": "{{ value_json.room_temp }}", "unit_of_measurement": "\\u00b0C", "device": {"identifiers": "00:04:2f:94:95:5b", "manufacturer": "Danfoss", "model": "eTRV", "name": "bedroom"}, "availability_topic": "etrv/state", "payload_available": "online", "payload_not_available": "offline"}'
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/sensor/etrv/00_04_2f_94_95_5b_last_update/config: b'{"device_class": "timestamp", "name": "bedroom Last Update", "unique_id": "00_04_2f_94_95_5b_last_update", "state_topic": "etrv/bedroom/state", "value_template": "{{ value_json.last_update }}", "device": {"identifiers": "00:04:2f:94:95:5b", "manufacturer": "Danfoss", "model": "eTRV", "name": "bedroom"}, "availability_topic": "etrv/state", "payload_available": "online", "payload_not_available": "offline"}'
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('climate', 'etrv 00_04_2f_94_95_5b_thermostat'): deque([])
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'device_class': 'battery', 'name': 'bedroom Battery', 'unique_id': '00_04_2f_94_95_5b_battery', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.battery }}', 'unit_of_measurement': '%', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor etrv 00_04_2f_94_95_5b_battery, sending update
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'bedroom Reported name', 'unique_id': '00_04_2f_94_95_5b_reported_name', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.name }}', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor etrv 00_04_2f_94_95_5b_rep_name, sending update
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'device_class': 'temperature', 'name': 'bedroom Temperature', 'unique_id': '00_04_2f_94_95_5b_temperature', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.room_temp }}', 'unit_of_measurement': '°C', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor etrv 00_04_2f_94_95_5b_temperature, sending update
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'device_class': 'timestamp', 'name': 'bedroom Last Update', 'unique_id': '00_04_2f_94_95_5b_last_update', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.last_update }}', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor etrv 00_04_2f_94_95_5b_last_update, sending update
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'etrv 00_04_2f_94_95_5b_battery') '{'device_class': 'battery', 'name': 'bedroom Battery', 'unique_id': '00_04_2f_94_95_5b_battery', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.battery }}', 'unit_of_measurement': '%', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}'
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.sovevaerelse_battery
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'etrv 00_04_2f_94_95_5b_rep_name') '{'name': 'bedroom Reported name', 'unique_id': '00_04_2f_94_95_5b_reported_name', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.name }}', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}'
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.sovevaerelse_reported_name
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'etrv 00_04_2f_94_95_5b_temperature') '{'device_class': 'temperature', 'name': 'bedroom Temperature', 'unique_id': '00_04_2f_94_95_5b_temperature', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.room_temp }}', 'unit_of_measurement': '°C', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}'
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.sovevaerelse_temperature
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'etrv 00_04_2f_94_95_5b_last_update') '{'device_class': 'timestamp', 'name': 'bedroom Last Update', 'unique_id': '00_04_2f_94_95_5b_last_update', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.last_update }}', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}'
2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.sovevaerelse_last_update
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'etrv 00_04_2f_94_95_5b_battery'): deque([])
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'etrv 00_04_2f_94_95_5b_rep_name'): deque([])
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'etrv 00_04_2f_94_95_5b_temperature'): deque([])
2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'etrv 00_04_2f_94_95_5b_last_update'): deque([])
2021-08-19 23:51:24 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on etrv/state: b'offline'

yes i do and previously rpi3 and that worked too

This looks fine I guess
are the errors gone from the log?
But your sensors are still unavailable?

Hello again,

I noticed that your sensors get discovered several times and ignored. logging “Already discovered”

2021-08-19 23:51:17 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'bedroom Reported name', 'unique_id': '00_04_2f_94_95_5b_reported_name', 'state_topic': 'etrv/bedroom/state', 'value_template': '{{ value_json.name }}', 'device': {'identifiers': '00:04:2f:94:95:5b', 'manufacturer': 'Danfoss', 'model': 'eTRV', 'name': 'bedroom'}, 'availability_topic': 'etrv/state', 'payload_available': 'online', 'payload_not_available': 'offline', 'platform': 'mqtt'}

2021-08-19 23:51:17 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor etrv 00_04_2f_94_95_5b_rep_name, sending update

while I don’t have such entries in my log,

Try to remove the MQTT auto discovery configuration from your Configuration,yaml like i did.

# mqtt:
#   discovery: true
#   broker: 192.168.0.XXXX
#   port: 1883
#   username:  XXXXX
#   password: XXXXX
#   birth_message:
#     topic: 'hass/status'
#     payload: 'online'

Kind regards,
Ghassan

hi. and thak you very much for your assistance.

i did try to comment out the MQTT part of the configuration. but nothing happend.

further. i just tested it on a raspberry pi 3 model B. and i get the exact same error. well. almost. some of the hex decimals are different.

wich leads me to think that either

  1. there is a module or pice of software that i am mising, or not configured correctly.
    or.
  2. the configuration on my setup is not correct.

or.
3. the thermostat has got new firmware and no longer compatible wuth the script.

I am running:

  • Hardware-revision B4
  • Firmware-revision: 2.08
  • Radioprotokolversion: 4.2
    which works fine.

Are your versions different?

Mine has the same values. so that should not be the problem.

do you have some other addon that is bluetooth related ?

No other Bluertooth rekated add-on but custom componenets.
try to put the mqtt log level to info, we might get more details

logger:
  default: info
  logs:
    homeassistant.components.mqtt: info

I can see the following in my general system lpg

2021-08-30 17:48:40 INFO (MainThread) [homeassistant.components.climate] Setting up climate.generic_thermostat
2021-08-30 17:48:40 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor etrv 00_04_2f_4E_B8_30_battery
2021-08-30 17:48:40 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor etrv 00_04_2f_4E_B8_30_rep_name
2021-08-30 17:48:40 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor etrv 00_04_2f_4E_B8_30_temperature
2021-08-30 17:48:40 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor etrv 00_04_2f_4E_B8_30_last_update
2021-08-30 17:48:40 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: climate etrv 00_04_2f_4E_B8_30_thermostat
2021-08-30 17:48:40 INFO (MainThread) [custom_components.hacs] Loaded 11 tasks

i got it to work. im not too sure what made the difference. but i did a reset

all while pushing the clock button
you pull out battery (disconnect one end)
put it back in
release clock button when a red light is lit.

Great news :slight_smile:

Thank you very much for your help :slight_smile:

You are very welcome, glade that you succeeded at last :slight_smile:

Hi everybody,

Just discovered an error that i wanted to warn you about.
I added a new valve and that caused the etrv2 addon to crash with a long error message ending by this:

File "/usr/local/lib/python3.8/site-packages/libetrv/fields/string.py", line 18, in from_raw_value
return raw_value.decode('ascii').strip('\0')
│ └ <method 'decode' of 'bytes' objects>
└ b'Sovev\xc3\xa6relset\x00\x00\x00'
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)`

After some research, I figured out that the error happened because the name of the valve in the Danfoss app, included a Danish letter “soveværelset” that could not be decoded. I changed the name to “Sove” and it did not crash any more.

So be aware of that, and don’t include none English letters :slight_smile:

Hi everyone,

https://github.com/HBDK/Eco2-Tools described here looked very promissing, but as I tried to follow the steps I got stuck on making etrv-scan work. When I check the logs after starting the addon, I see this:

Start scanning
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/site-packages/libetrv/cli.py", line 79, in <module>
    fire.Fire(CLI)
  File "/usr/local/lib/python3.8/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.8/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.8/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/libetrv/cli.py", line 22, in scan
    for device in eTRVDevice.scan(timeout):
  File "/usr/local/lib/python3.8/site-packages/libetrv/device.py", line 38, in scan
    devices = btle.Scanner().scan(timeout)
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 852, in scan
    self.start(passive=passive)
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 790, in start
    self._mgmtCmd("le on")
  File "/usr/local/lib/python3.8/site-packages/bluepy/btle.py", line 312, in _mgmtCmd
    raise BTLEManagementError("Failed to execute management command '%s'" % (cmd), rsp)
bluepy.btle.BTLEManagementError: Failed to execute management command 'le on' (code: 17, error: Invalid Index)
Detected eTRV devices:
Done scanning

I failed to google any reasonable explanation on what “code: 17, error: Invalid Index” means and how to get around it, so I was wondering, someone here might have faced similar issue already and can advise something.

Here are my setup details:
Home Assistant 2021.10.5 on Raspberry PI 4
Ubuntu 20.04.3 LTS
Docker version: 20.10.7