Beta for Hysen thermostats powered by broadlink

Hi Fox, can you please share your thermostat card (with schedule) configuration?

Hi Fox, tried on my installation but it doesn’t work:

the current temprature is on 0 and the thermostat doesn’t report.

Hi,
I have a BEOK313-WiFi thermostat. I was able to remotely change the schedule and some advanced settings like: min_temp and loop_mode and roomtemp_offset.
Then I turned off the thermostat and both of them remained changed. Then I turned it on and off and the settings were still properly set. However, after another turning it on, all the advanced settings were reset to the default values: min_temp to 5st C, loop_mode and roomtemp_offset to 0 but a schedule remained changed. Has anybody noticed such behavior? Should I change any other settings to make the changes permanent? Here’s my all settings:

hvac_modes: off,heat,auto
current_temperature: 19.5
min_temp: 5
max_temp: 35
target_temp_step: 0.5
temperature: 5
sfw_version: 2.0.1
power_state: 0
away_mode: false
sensor_mode: 0
room_temp: 19.5
external_temp: 0
heating_active: 0
auto_override: 0
external_sensor_temprange: 42
deadzone_sensor_temprange: 1
loop_mode: 0
roomtemp_offset: 0
anti_freeze_function: 1
poweron_mem: 1
remote_lock: 0
clock_hour: 17
clock_min: 32
clock_sec: 33
day_of_week: 2
week_day: [{'start_hour': 7, 'start_minute': 0, 'temp': 21.0}, {'start_hour': 22, 'start_minute': 0, 'temp': 18.0}, {'start_hour': 22, 'start_minute': 0, 'temp': 18.0}, {'start_hour': 22, 'start_minute': 0, 'temp': 18.0}, {'start_hour': 22, 'start_minute': 0, 'temp': 18.0}, {'start_hour': 22, 'start_minute': 0, 'temp': 18.0}]
week_end: [{'start_hour': 7, 'start_minute': 0, 'temp': 21.0}, {'start_hour': 22, 'start_minute': 0, 'temp': 18.0}]
friendly_name: Termostat
supported_features: 1

How do you do it?

Same as awr001c:
Please, Hi Fox, can you please share your thermostat card (with schedule) configuration?

Yeah, sure; was abroad for a while and mail notifications are turned off :wink:

DISCLAIMER: I don’t proviced support since I’m not on this forum alot. This requires you to edit the hysen component, so it’ll probably break if the hysen component is updated (unless my issues on github are merged)!

So, for starters:

  1. You need to modify the hysen component as stated in the 2 issues I posted on github:
    22 -> for the automation
    21 -> Better solution for the state + HVAC_MODE is used by the simple thermostat card
    (As new user I can only add 2 hyperlinks in 1 post, so sorry for not linking to the issues directly)

  2. I’m using the Simple thermostat card

  3. You’ll need to define some inputs in your HA configuration.yaml:
    –datetime for the periods
    input_datetime.week_period1_start
    input_datetime.week_period2_start
    input_datetime.week_period3_start
    input_datetime.week_period4_start
    input_datetime.week_period5_start
    input_datetime.week_period6_start
    input_datetime.weekend_period1_start
    input_datetime.weekend_period2_start
    –numbers for the temps
    input_number.week_period1_temp
    input_number.week_period2_temp
    input_number.week_period3_temp
    input_number.week_period4_temp
    input_number.week_period5_temp
    input_number.week_period6_temp
    input_number.weekend_period1_temp
    input_number.weekend_period2_temp
    –boolean for the toggle switch + I have an automation that gets the current value from the thermostat into the inputs when this boolean changes state
    input_boolean.schedule_control

Once you got that up and running, just add the simple thermostat card and the schedule card:

cards:
      - control:
          _names: false
        entity: climate.main_thermostat
        hide:
          state: true
        icon:
          heating: 'mdi:radiator'
          idle: 'mdi:radiator-disabled'
        name: Thermostat
        sensors:
          - entity: sensor.main_thermostat_auto_override
            name: Auto_Override
        step_size: 0.5
        type: 'custom:simple-thermostat'
      - cards:
          - entities:
              - entity: input_boolean.schedule_control
                icon: 'mdi:calendar-clock'
            type: entities
          - card:
              cards:
                - cards:
                    - entities:
                        - entity: input_datetime.week_period1_start
                          name: 'week1'
                        - entity: input_datetime.week_period2_start
                          name: 'week2'
                        - entity: input_datetime.week_period3_start
                          name: 'week3'
                        - entity: input_datetime.week_period4_start
                          name: 'week4'
                        - entity: input_datetime.week_period5_start
                          name: 'week5'
                        - entity: input_datetime.week_period6_start
                          name: 'week6'
                        - entity: input_datetime.weekend_period1_start
                          name: 'weekend1'
                        - entity: input_datetime.weekend_period2_start
                          name: 'weekend2'
                      type: entities
                    - entities:
                        - entity: input_number.week_period1_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.week_period2_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.week_period3_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.week_period4_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.week_period5_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.week_period6_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.weekend_period1_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                        - entity: input_number.weekend_period2_temp
                          icon: 'mdi:home-thermometer-outline'
                          name: ' '
                      type: entities
                  type: horizontal-stack
                - entity: climate.main_thermostat
                  name: Send Schedule
                  show_icon: false
                  show_name: true
                  tap_action:
                    action: call-service
                    service: script.set_thermostat_schedule
                  type: entity-button
              type: vertical-stack
            conditions:
              - entity: input_boolean.schedule_control
                state: 'on'
            type: conditional
        type: vertical-stack

And the automation:

- id: aut_thermostat_schedule
  alias: aut_thermostat_schedule
  trigger:
  - entity_id: input_boolean.schedule_control
    platform: state
  condition:
  action:
  - data_template:
      entity_id: input_number.week_period1_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[0][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.week_period2_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[1][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.week_period3_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[2][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.week_period4_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[3][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.week_period5_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[4][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.week_period6_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[5][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.weekend_period1_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_end'')|from_json)[0][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_number.weekend_period2_temp
      value: '{{ (state_attr(''climate.main_thermostat'', ''week_end'')|from_json)[1][''temp'']
        }}'
    service: input_number.set_value
  - data_template:
      entity_id: input_datetime.week_period1_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[0][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[0][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.week_period2_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[1][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[1][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.week_period3_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[2][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[2][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.week_period4_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[3][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[3][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.week_period5_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[4][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[4][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.week_period6_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[5][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_day'')|from_json)[5][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.weekend_period1_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_end'')|from_json)[0][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_end'')|from_json)[0][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
  - data_template:
      entity_id: input_datetime.weekend_period2_start
      time: '{{ (state_attr(''climate.main_thermostat'', ''week_end'')|from_json)[1][''start_hour'']
        }}:{{ (state_attr(''climate.main_thermostat'', ''week_end'')|from_json)[1][''start_minute'']
        }}:00'
    service: input_datetime.set_datetime
1 Like

thanks Fox !!.
I got to point 2.
Point 3 I don’t know how to do it, can you help me?
Thanks, Alberto

Hi fox,
I tried to insert the code in a card but it doesn’t work.
I inserted a card thermostat and in that I see the circle with ok temperatures and it works if I change the temperatures.
But the card you attached can’t get it to work despite having added all the changes.
Can you tell me something more?

Thanks, Alberto

Good evening,
I just can’t replicate the Fox card and I can’t understand why.
I added a card and I simply pasted the code and the card shows only the part of the thermostat ignoring everything else:

this is the code entered:

card:
  - control:
      _names: false
    entity: climate.house_thermostat_1
    hide:
      state: true
    icon:
      heating: 'mdi:radiator'
      idle: 'mdi:radiator-disabled'
    name: Thermostat
    sensors:
      - entity: sensor.house_thermostat_auto_override
        name: Auto_Override
    step_size: 0.5
    type: 'custom:simple-thermostat'
  - cards:
      - entities:
          - entity: input_boolean.term1_schedule_control
            icon: 'mdi:calendar-clock'
        type: entities
      - card:
          cards:
            - cards:
                - entities:
                    - entity: input_datetime.term1_week_period1_start
                      name: week1
                    - entity: input_datetime.term1_week_period2_start
                      name: week2
                    - entity: input_datetime.term1_week_period3_start
                      name: week3
                    - entity: input_datetime.term1_week_period4_start
                      name: week4
                    - entity: input_datetime.term1_week_period5_start
                      name: week5
                    - entity: input_datetime.term1_week_period6_start
                      name: week6
                    - entity: input_datetime.term1_weekend_period1_start
                      name: weekend1
                    - entity: input_datetime.term1_weekend_period2_start
                      name: weekend2
                  type: entities
                - entities:
                    - entity: input_number.term1_week_period1_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_week_period2_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_week_period3_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_week_period4_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_week_period5_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_week_period6_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_weekend_period1_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                    - entity: input_number.term1_weekend_period2_temp
                      icon: 'mdi:home-thermometer-outline'
                      name: ' '
                  type: entities
              type: horizontal-stack
            - entity: climate.house_thermostat_1
              name: Send Schedule
              show_icon: false
              show_name: true
              tap_action:
                action: call-service
                service: script.set_thermostat_schedule
              type: entity-button
          type: vertical-stack
        conditions:
          - entity: input_boolean.term1_schedule_control
            state: 'on'
        type: conditional
    type: vertical-stack
entity: climate.house_thermostat_1
type: 'custom:simple-thermostat'

I tried to create another card with the times and that’s it:

this is the code:

card:
  - control:
      _names: false
    entity: climate.house_thermostat_1
    hide:
      state: true
    icon:
      heating: 'mdi:radiator'
      idle: 'mdi:radiator-disabled'
    name: Thermostat
    sensors:
      - entity: sensor.house_thermostat_auto_override
        name: Auto_Override
    step_size: 0.5
type: horizontal-stack
title: Termostato sala 1
cards:
  - type: entities
    entities:
      - entity: input_datetime.term1_week_period1_start
        name: week1
      - entity: input_datetime.term1_week_period2_start
        name: week2
      - entity: input_datetime.term1_week_period3_start
        name: week3
      - entity: input_datetime.term1_week_period4_start
        name: week4
      - entity: input_datetime.term1_week_period5_start
        name: week5
      - entity: input_datetime.term1_week_period6_start
        name: week6
      - entity: input_datetime.term1_weekend_period1_start
        name: weekend1
      - entity: input_datetime.term1_weekend_period2_start
        name: weekend2
  - type: entities
    entities:
      - entity: input_number.term1_week_period1_temp
        icon: 'mdi:home-thermometer-outline'
        name: '1 '
      - entity: input_number.term1_week_period2_temp
        icon: 'mdi:home-thermometer-outline'
        name: '2 '
      - entity: input_number.term1_week_period3_temp
        icon: 'mdi:home-thermometer-outline'
        name: '3 '
      - entity: input_number.term1_week_period4_temp
        icon: 'mdi:home-thermometer-outline'
        name: '4 '
      - entity: input_number.term1_week_period5_temp
        icon: 'mdi:home-thermometer-outline'
        name: '5 '
      - entity: input_number.term1_week_period6_temp
        icon: 'mdi:home-thermometer-outline'
        name: '6 '
      - entity: input_number.term1_weekend_period1_temp
        icon: 'mdi:home-thermometer-outline'
        name: '7 '
      - entity: input_number.term1_weekend_period2_temp
        icon: 'mdi:home-thermometer-outline'
        name: '8 '

This is in configuration.yaml under input date_time

# Input orari di schedulazione temperature termostato 1
  term1_week_period1_start:
    name: term1_week_period1_start
    has_date: false
    has_time: true
  term1_week_period2_start:
    name: term1_week_period2_start
    has_date: false
    has_time: true
  term1_week_period3_start:
    name: term1_week_period3_start
    has_date: false
    has_time: true
  term1_week_period4_start:
    name: term1_week_period4_start
    has_date: false
    has_time: true
  term1_week_period5_start:
    name: term1_week_period5_start
    has_date: false
    has_time: true
  term1_week_period6_start:
    name: term1_week_period6_start
    has_date: false
    has_time: true
  term1_weekend_period1_start:
    name: term1_weekend_period1_start
    has_date: false
    has_time: true
  term1_weekend_period2_start:
    name: term1_weekend_period2_start
    has_date: false
    has_time: true

This code in configuration.yaml under input_number

# Input temperature di schedulazione temperature termostato 1
  term1_week_period1_temp:
    name: term1_week_period1_temp
    min: 15
    max: 25
    step: .5
  term1_week_period2_temp:
    name: term1_week_period2_temp
    min: 15
    max: 25
    step: .5
  term1_week_period3_temp:
    name: term1_week_period3_temp
    min: 15
    max: 25
    step: .5
  term1_week_period4_temp:
    name: term1_week_period4_temp
    min: 15
    max: 25
    step: .5
  term1_week_period5_temp:
    name: term1_week_period5_temp
    min: 15
    max: 25
    step: .5
  term1_week_period6_temp:
    name: term1_week_period6_temp
    min: 15
    max: 25
    step: .5
  term1_weekend_period1_temp:
    name: term1_weekend_period1_temp
    min: 15
    max: 25
    step: .5
  term1_weekend_period2_temp:
    name: term1_weekend_period2_temp
    min: 15
    max: 25
    step: .5

why can’t I put all the code in one card?
Have you resuscitated us?

Thanks, Alberto

Hello to all,

I have installed the latest version of the plugin (commit 9623708) within HA 0.102.3 on a Raspberry pi 4 Model B. My thermostat is Hysen HY08-1 (http://www.xmhysen.com/products_detail/productId=191.html)

My configuration.yaml reads:

climate:
  - platform: hysen
    scan_interval: 15
    devices:
      main_thermostat:
        name: Main Thermostat
        host: 192.168.150.41
        host_dns: xxx.xxx.xxx
        mac: 'XX:XX:XX:XX:XX:XX'
        target_temp_default: 20
        target_temp_step: 0.5
        sync_clock_time_per_day: True
        current_temp_from_sensor_override: 0
        update_timeout: 5

When running HA, I get within the ha log:

ERROR (MainThread) [custom_components.hysen.climate] Failed to connect to Broadlink Hysen device MAC:XX:XX:XX:XX:XX:XX, IP:192.168.150.41, Error:timed out

The thermostat at the moment is bound to the Thermostat App and connected to the local WiFi. I could not follow the instructions for manually setting the IP as depicted in https://github.com/mairas/hysen since the thermostat has different buttons that the ones described (e.g. there is no “Time” button).

I performed a portscan to the thermostat as well as other devices within the same WiFi network to determine that the router/access point is not blocking any ports. I found that the thermostat at the IP bound to the network has no inbound ports active, thus the HA plugin (which works at port 80) cannot connect and times out.

Do you have any recommendations how I can make it work with HA and forget about the horrible temp app?

Thank you!

After performing packet capture and analyzing, I have determined that the hysen HA component is incompatible with this thermostat (Hysen HY08-1).

Instead, the tuya HA integration (https://www.home-assistant.io/integrations/tuya/) runs perfectly. Use the Tuya Smart app (available at Google Play Store) instead of Smart RM app to register the device within WiFi and the Tuya IoT platform and use the credentials to setup the tuya HA integration!

If the temperature provided by the platform is incorrect, follow the instructions here -> Smart Life (tuya) show wrong temperature

Wow! https://github.com/mairas/hysen works perfectly!!
Why is still in beta mode?

hello I have HY08 that seems to be incompatible with this component in fact it doesnt use Smart RM but instead it uses smart Heating app and it seems that it is not compatible with tuya either any ideas how to make it work with HA?

Have you defined the input_boolean.term1_schedule_control?
Because it’s a conditional card based on that boolean input to show/hide it. I’m not a HA-expert so I don’t know if it’ll work without it, but that’s one of the things you didn’t mention :wink:

PS: sorry for the late reply, I was abroad.

Hi all,

I haven’t really been following this discussion too closely; sorry about that. And kudos to Mark Carter and others for providing great support and updating the component as needed. I recently switched my own installation from a manual one to Hass.io. I wasn’t totally comfortable dragging the old custom component to that world because I think it’s a bit finicky and I don’t want to create a tight dependency between that and the Hass.io HA installation. Instead, I rewrote the Hysen component into a separate MQTT gateway that can be run as a Docker container of its own. In other words, a separate Hass.io add-on. This should help in providing greater resilience either way: there is no tight coupling between HA and the hysen libraries. If HA APIs are updated, the gateway still works, and if the gateway decides to no longer work, it won’t take all of HA down with it.

I’ve run my own two-device installation for a few days with the new gateway and it seems to work well enough for my purposes. I’d appreciate if any courageous people would be willing to give it a spin: https://github.com/mairas/hysen-mqtt

Works like a charm, thanks a million!

My other thermostats show the actual temp as well, this one only shows the set temp. Any chance that can be added?

@mairas lol I wish you had said, the first component I wrote for this was a docker plugin to hassio, and could have given you that one. I ditched that because at the time home assistant did not support some of the functions I wanted out of the box with the generic component. I have to say I’m moving away from these thermostats and building my own mqtt based ones per room based on either esp32/8266 or ardunio. I cant stand the hystisis range on them, I find the room either to hot or to cold on the 1.5 degree swings

Thanks for reporting!

I suppose you’re not using external temperature sensors? Their use is hard-coded in the codebase at the moment. I can easily add a configuration variable for switching all thermostats between reporting the internal or external temperature. If you’d rather have that configured for individual devices, that’d require a bit more thought. What say you?

Heh, great minds think alike. And mine is hobbling somewhere behind. :smiley: Oh well, it’s done now.

I share your distaste with these sensors. In addition to the high hysteresis, they’re insecure, the manufacturer app is iffy, and the existing Python integration modules are not so great. I’m not keen on DIYing on permanent electrical installations in our house, though.

I think I’ve found a solution: check out the Beca thermostats (or any other similar); they’re based on ESP8266 and there’s already open source firmware available for them: https://github.com/klausahrenberg/WThermostatBeca

I didn’t get them yet but intend to do so soon.

1 Like

I only have one thermostat of this type at the moment. I use the floor sensor and it doesn’t seem to report the temp back, only the set temp.