Danfoss wireless thermostat control via Home Assistant

 

 

 

 

 

 


About

 

This project Allows a Danfoss RX1, RX2 and others to be controlled from Home Assistant using a JeeLink v3c (434MHz version)
 
Since heating can be the single most expensive home utility, getting control of it is surely a must.
I had looked at this for a long time and considered modifying the receiver, over-riding it with my own relay connected to an ESP device. However physically hacking it wasn't something I really wanted to do.
As I'd already wrote working code in the past for RF transmitters and a receiver for OSA, I thought this must be reverseable, assuming it's not a rolling code? I tried to capture the codes using my existing 434MHz AM receivers. The code seemed to come through ok, but I could never get it to trigger the heating receiver when retransmitting it. After revisiting this some time later with an SDR receiver, I spotted right away that the code was frequency modulated (FM). For whatever reason, the project went by the wayside. That was until I came across AndyHacks website. He had achieved the goal. So this section of the project is fully credited to him. He completley breaks down how he decoded it on his website and how he created code for the JeeLink to not only transmit, but also receive codes from existing thermostats.

Part One: RF protocol decoding

Part Two: transmitting frames

 


Items needed:


A JeeLink v3c - Must be the 434MHz version

Andy Peace's code for the JeeLink device - (Local copy here) - See the licensing agreement

The Arduino environment to initially program the JeeLink module

 

 


Setup


Install and run the Arduino IDE either on a Rasberry PI, Windows or Linux.
Plug in the JeeLink into a USB port.

Unzip and then load thermostat.ino



Goto Select board and choose Arduino Uno. Also select the port of the JeeLink device.



Click the Arrow → upload code.
Once complete, go to tools and serial monitor.

You should get an initial output:

Danfoss thermostat transceiver

If you have this, next try turning your thermostat up and down to trigger your boiler to start and stop. If the JeeLink is working, you will get some received commands output in the serial monitor.

 




Now you have your thermostat's code. Try issuing an on command, where 0x1234 is the code that was received for your thermostat. Type in the Message box in the Arduino Serial monitor using your actual code

Switch on the boiler

O 0x1234
Switch off the boiler
X 0x1234

If everything is working up to here, the JeeLink is ready to use. You should not need the Arduino IDE again.



Integration into Home Assistant

Some years have passed between actually setting this up and documenting it (2025). HA has changed considerably since then. There may be a better way of adding this in.

Plug the JeeLink into whichever port you want to use.
(It should be possible to use any port. I had problems with this in the past which I have since solved).

You will need a terminal installed into Home Assistant to initially find the USB devices name. The terminal will be in
Settings > Add-ons.
If there isn't one, you can click "Add-on store" and install one. I've used "Terminal & SSH" for this.

Once installed, click to open the info page, Start the program, then Open web UI.

You should be presented with a bunch of info, then the command prompt like the right image.

We need to list the serial devices connected to Home Assistant. Type into the terminal:

ls -l /dev/serial/by-id/

My machine shows:

total 0
lrwxrwxrwx		1	root	*********	13 Oct	7 17:27 usb-FTDI_FT232R_USB_UART_AI04PHID-if00-port0 -> ../../ttyUSB0


This is the only serial device connected to my Home Assistant machine.
The full device name which is the combined path and name needed in Home Assistant is:
/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI04PHID-if00-port0

 

Next you will need to edit some files. Install File editor (settings > Add-ons) if you don't have it already.

Open the configuration.yaml file, and add under the sensor: section (if there is one), customize the name to match your JeeLink name.


sensor:
  - platform: serial       # Danfoss boiler controller
    serial_port: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI04PHID-if00-port0
    baudrate: 57600
    name: danfoss_usb_controller

Lets test this far to see if we get anything. Restart Home Assistant to pickup this addition. Once done, go into one of your pages and add an entity card. Add the entity name danfoss_usb_controller
That will show you the most recent status of the JeeLink USB dongle. Initially showing Danfoss thermostat transceiver, then whatever it receives or sends.

Next, we need an actual way to switch the boiler on and off.
I use include files to keep the configuration.yaml file a bit tidier, but for the sake of simplifying things, we will add the control straight into the same configuration.yaml file.

command_line:
  - switch
        name: Boiler state
        unique_id 'boiler_state'
        icon: mdi:fire
        command_on: echo -e 'O 0x1234\n' > /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI04PHID-if00-port0
        command_off: echo -e 'X 0x1234\n' > /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI04PHID-if00-port0

Again, make sure the long strings match your own device. Restart Home Assistant again.
Add a button entity alongside the danfoss_usb_controller. Look for the entity 'Boiler state'.
Once added, try clicking to toggle it on/off. The danfoss USB controller state should show what it's sending into the USB dongle.

If thats working, job done !


You need to setup a climate entity to take control of the boiler state along with a thermometer entity.
Here is the settings I currently use:


climate:
  - platform: generic_thermostat
    name: Home
    unique_id: 'home_heating'
    heater: switch.boiler_state
    target_sensor: sensor.lounge_temperature
    min_temp: 16
    max_temp: 22
    ac_mode: false
#    target_temp: 19
    cold_tolerance: 0.2
#   if target temperature is 25 and  tolerance is 0.1 the heater will stop when the sensor equals or goes above 25.1    
    hot_tolerance: 0.1
#   min_cycle_duration:
#     seconds: 180
#   Keep_alive overrides min_cycle_duration
    keep_alive:
      minutes: 3
    initial_hvac_mode: "off"
    home_temp: 20.0
    away_temp: 16
    #activity_temp: 18
    precision: 0.1  



The clockwork timer we used had a 1 hour boost button. I recreated something similar in Home Assistant to copy that.
When it's started, it shows 15 minutes. You can then keep tapping it to get the length of time needed. Mine is limited to 1 hour.
If the users want it on again, they have to keep restarting it rather than it just staying on. This is EXACTLY why I wanted the project !!

 

I will post the yaml for this once I've upgraded the automation. Currently it's old yaml and a bit clunky.

The holy grail would be to have electronic TRV's on all the radiatiors, so only occupied rooms get those radiators turned up full.
Expensive, but I will add this eventually. I'm currently adding presence sensors to rooms, in fact this is a whole array of sensors on a tiny PCB via an ESP32-C3.
This will get it's own page on the site once complete.

Any question, suggestions - please use my contact page.
Ian.


 

 

 

 

 

 

 
 
 

 

 

← Back to Projects