Sendo A/C unit with Wifi Control (BroadLink_OEM-T1)

Hi, no, sorry, I haven’t found the time yet.

1 Like

If we could leverage the internal temperature sensor of the AC units we could use the Generic Thermostat component.

2 Likes

So I’ve had a bit of a play around and managed to get this working with the mqtt hvac climate component plus a little bit of automations.
Because these units have a separate power function to the mode I was unable to turn the unit on with the regular thermostat card. I also ran into an issue where the commands for auto, heat, cool, etc from the thermostat card didn’t work because the AC unit was expecting AUTO, HEAT, COOL. I managed to get around both issues with automations so that I can now control my Rinnai Air Conditioners with Home Assistant using the Lovelace Thermostat card. It’s not perfect, but it works.

I can post my configs if anyone want’s to achieve this too.

1 Like

@wjbeckett: I have an AC with Broadlink WIFI and I would like to try your workaround :slight_smile:

@labachev alright. I’ll post my config in a few hours when I get up.

Okay, so here’s my configuration.
It’s not perfect as I said because the Thermostat Card assumes the climate device is turned on by selecting a mode and that also “off” is one of those modes. The Thermostat Card doesn’t support a separate on/off toggle like my air conditioner has. So I had to workaround that with automations. The MQTT Climate component also does not have a separate template mode for receiving the MQTT commands, it only has one for sending. So I had to use automations to get around that too.

Also, the internal temperature sensor isn’t exposed in this config so it will only show the temp from the climate device.

Anyway, Here we go.

# configuration.yaml
climate:
  - platform: mqtt
    name: Bedroom
    modes:
      - "auto"
      - "cool"
      - "heat"
      - "off"
    fan_modes:
      - auto
      - high
      - mid
      - low
    power_command_topic: "/aircon/<mac_address>/power/set"
    power_state_topic: "/aircon/<mac_address>/power/value"
    mode_command_topic: "temp/climate/hvac_mode_bedroom"
    mode_state_topic: "/aircon/<mac_address>/mode/value"
    mode_state_template: >-
      {% set values = { 'AUTO':'auto', 'HEATING':'heat',  'COOLING':'cool', 'OFF':'off' } %}
      {{ values[value] if value in values.keys() else 'OFF' }}
    temperature_command_topic: "/aircon/<mac_address>/temp/set"
    temperature_state_topic: "/aircon/<mac_address>/temp/value"
    fan_mode_command_topic: "/aircon/<mac_address>/fanspeed/set"
    fan_mode_state_topic: "/aircon/<mac_address>/fanspeed/set"
    min_temp: 16
    max_temp: 32
    temp_step: 0.5
    precision: 0.5
# Automations.yaml
- alias: hvac-mode-controller-bedroom
  trigger:
    platform: mqtt
    topic: temp/climate/hvac_mode_bedroom
  condition:
    condition: or
    conditions:
      - condition: template
        value_template: "{{ trigger.payload == 'auto' }}"
      - condition: template
        value_template: "{{ trigger.payload == 'heat' }}"
      - condition: template
        value_template: "{{ trigger.payload == 'cool' }}"
  action:
    - service: mqtt.publish
      data_template:
        topic: /aircon/<mac_address>/power/set
        payload: 'ON'
    - service: mqtt.publish
      data_template:
        topic: /aircon/<mac_address>/mode/set
        payload: >
          {% set values = { "auto":"AUTO", "heat":"HEATING", "cool":"COOLING", "off":"OFF" } %}
          {{ values[trigger.payload] if trigger.payload in values.keys() else "off" }}

- alias: hvac-mode-controller-bedroom-power
  trigger:
    platform: mqtt
    topic: temp/climate/hvac_mode_bedroom
    payload: 'off'
  action:
    - service: mqtt.publish
      data_template:
        topic: /aircon/<mac_address>/power/set
        payload: 'OFF'
    - service: climate.set_hvac_mode
      data:
        entity_id: climate.bedroom
        hvac_mode: 'off'

Here’s the look from the UI.
image

You’ll notice in the automations above, When selecting the mode, I have to send the power on command first, this is because my AC unit will not turn on just by switching modes.

Hope this makes sense to/helps someone.

2 Likes

I’ve recently had some Kelvinator ‘smart’ split systems (KSV25HWH) installed which look to use Broadlink OEM. The only clues I have though are the default hostname showing ‘BL’ in DHCP but also the sqlite file from the app on my phone has ‘BL’ scattered around the place.

Unfortunately I didn’t have much luck with the broadlink_ac_mqtt code as I have the AC’s sitting on a separate IoT VLAN so I need to play around with passing broadcasts somehow.

Hi all.

How run monitor.py in home assistant ?

THX

I run the monitor program outside of HA (on my host server - I use HA in docker). The monitor.py program could be run from anywhere in your internal network.

Ehlo

Im busy doing more reverse engineering on the protocol and did lot of rework on the main routine to make it more stable… i did not realize so many people actually used the library so it never went beyond a “usable” system

Ill also create auto mqtt discovery config as soon as last bits of protocol is sorted (name etc) then it should show up automatically in homeassist once ac is discovered…

Please follow on github repo as im not normally reading homeassist forums.


L:
2 Likes

I have been running the updated library for a few days now and it’s a lot more stable now.

I have created as docker image for it as well (just waiting for the merge request to be approved).

I have two main problems:

1st.
I have installed monitor.py as a systemd outside homeassistant docker but on the same machine - it is running on startup and sometimes it starts correctly and sometimes I have got an error:

cze 06 10:43:24 sopot acbroadlink.sh[599]:     dev = gendevice(devtype, host, mac,name=name,cloud=cl
cze 06 10:43:24 sopot acbroadlink.sh[599]:   File "././ext/broadlink/ac_db.py", line 19, in gendevic
cze 06 10:43:24 sopot acbroadlink.sh[599]:     return ac_db(host=host, mac=mac,name=name, cloud=clou
cze 06 10:43:24 sopot acbroadlink.sh[599]:   File "././ext/broadlink/ac_db.py", line 327, in __init_
cze 06 10:43:24 sopot acbroadlink.sh[599]:     if self.auth() == False:
cze 06 10:43:24 sopot acbroadlink.sh[599]:   File "././ext/broadlink/ac_db.py", line 166, in auth
cze 06 10:43:24 sopot acbroadlink.sh[599]:     response = self.send_packet(0x65, payload)
cze 06 10:43:24 sopot acbroadlink.sh[599]:   File "././ext/broadlink/ac_db.py", line 242, in send_pa
cze 06 10:43:24 sopot acbroadlink.sh[599]:     response = self.cs.recvfrom(1024)
cze 06 10:43:24 sopot acbroadlink.sh[599]: socket.timeout: timed out

It looks like monitor.py cannot connect to bu I do not know if it cannot connects to MQTT or AirConditionig?
I have created script that starts monitor.py 120 seconds after system bootup and it helped much but does not resolved problem 100%

2nd… Second problem is that I can Publish packet to AirConditioning from HomeAssistant->Developer Tools->MQQT - AirConditioning Turn ON/OFF etc. using correct packets.
Problem is that I do not have any GUI in HomeAssistant Overview. How to do it? I have change configuration.yaml and Automations.yaml according to your direction but on HomeAssistant GUI nothing relataed to AC is not displayed. How to do it? Please help.

Okay, so a lot has changed with the monitor.py script in the last day or so. It’s a lot more stable and you no longer need any of my automations which I had outlined above.

Monitor.py will now allow HA to autodiscover your AC units. So as long as you have mqtt autodiscovery setup in HA it should auto add your AC units as climate devices in HA.

It is strange but it does not discover ma AirConditioning. My Mosquito MQQT discovers any other devices like Zigbee sensors automatically but not discovers AC.
What should I check, do You have any suggestion?

Grab the latest version of monitor.py from GitHub and run
./monitor.py -Hd
That’ll dump the info that is sent to MQTT discovery.
Make sure its actually pulling information first.

I have newest “monitor.py”
Here is my dump of ./monitory.py -Hd

*********** start copy below ****************
climate:
- action_topic: /aircon/c8f7429c8539/homeassistant/set
  current_temperature_topic: /aircon/c8f7429c8539/ambient_temp/value
  fan_mode_command_topic: /aircon/c8f7429c8539/fanspeed_homeassistant/set
  fan_mode_state_topic: /aircon/c8f7429c8539/fanspeed_homeassistant/value
  fan_modes:
  - Auto
  - Low
  - Medium
  - High
  max_temp: 32.0
  min_temp: 16.0
  mode_command_topic: /aircon/c8f7429c8539/mode_homeassistant/set
  mode_state_topic: /aircon/c8f7429c8539/mode_homeassistant/value
  modes:
  - 'off'
  - cool
  - heat
  - fan_only
  - dry
  name: ''
  platform: mqtt
  precision: 0.5
  temperature_command_topic: /aircon/c8f7429c8539/temp/set
  temperature_state_topic: /aircon/c8f7429c8539/temp/value

**************** Start copy here ****************

Below is start log of running monitor.py
It looks like it connects to MQTT but in HomeAssistant nothing appears.
I think that maybe there is a problem with my MQTT Discovery?
I Use Mosquito MQTT and it discovers automatically Zigbee devices so autodiscovery seems to work.

2020-06-05 20:43:31,451,451 DEBUG    [monitor.py:557] /home/sopot/broadlink_ac_mqtt/monitor.py v1.0.6 is starting up
2020-06-05 20:43:31,451,451 DEBUG    [monitor.py:559] Loglevel set to DEBUG
2020-06-05 20:43:31,459,459 DEBUG    [monitor.py:485] /tmp/ac_to_mqtt.pid already exists, checking if stale
2020-06-05 20:43:31,459,459 INFO     [monitor.py:494] Pid is stale, so we'll just overwrite it go on
2020-06-05 20:43:31,460,460 INFO     [monitor.py:615] Starting Monitor...
2020-06-05 20:43:31,460,460 DEBUG    [monitor.py:617] Starting mainloop, responding on only events
2020-06-05 20:43:31,461,461 DEBUG    [monitor.py:268] Coneccting to MQTT: 192.168.0.5 with client ID = ac_to_mqtt
2020-06-05 20:43:31,463,463 DEBUG    [monitor.py:397] Mqtt connected! client=<paho.mqtt.client.Client object at 0x7f792d008990>, userdata=None, flags={'session present': 0}, rc=0
2020-06-05 20:43:31,464,464 DEBUG    [monitor.py:402] Listing on /aircon/+/+/set for messages
2020-06-05 20:43:31,464,464 DEBUG    [monitor.py:239] publishing on topic "/aircon/LWT", data "online"
2020-06-05 20:43:36,469,469 INFO     [monitor.py:648] Stopping Monitor...
2020-06-05 20:45:06,482,482 DEBUG    [monitor.py:557] /home/sopot/broadlink_ac_mqtt/monitor.py v1.0.6 is starting up
2020-06-05 20:45:06,482,482 DEBUG    [monitor.py:559] Loglevel set to DEBUG
2020-06-05 20:45:06,491,491 INFO     [monitor.py:615] Starting Monitor...
2020-06-05 20:45:06,491,491 DEBUG    [monitor.py:617] Starting mainloop, responding on only events
2020-06-05 20:45:06,492,492 DEBUG    [monitor.py:268] Coneccting to MQTT: 192.168.0.5 with client ID = ac_to_mqtt
2020-06-05 20:45:06,495,495 DEBUG    [monitor.py:397] Mqtt connected! client=<paho.mqtt.client.Client object at 0x7f1d221da450>, userdata=None, flags={'session present': 0}, rc=0
2020-06-05 20:45:06,495,495 DEBUG    [monitor.py:402] Listing on /aircon/+/+/set for messages
2020-06-05 20:45:06,495,495 DEBUG    [monitor.py:239] publishing on topic "/aircon/LWT", data "online"
2020-06-05 20:45:06,557,557 DEBUG    [ac_db.py:321] Debugging Enabled
2020-06-05 20:45:06,558,558 DEBUG    [ac_db.py:326] Authenticating
2020-06-05 20:45:06,619,619 DEBUG    [ac_db.py:330] Getting current details in init
2020-06-05 20:45:06,892,892 DEBUG    [ac_db.py:518] Acinfo Raw Response: 00100010 00000000 10111011 00000000 00000111 00000000 00000000 00000000 00011000 00000000 00000001 00100001 11100000 00100000 00000000 00000000 00000000 00111001 00111000 00111000 00111000 01100100 00101111 00101111 00101110 00111001 00000000 00000000 10101000 10101110 00000000 00000000 00000000 00000110 11001101 11001010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000
2020-06-05 20:45:06,893,893 DEBUG    [ac_db.py:519] Acinfo Raw Hex: 22 00 bb 00 07 00 00 00 18 00 01 21 e0 20 00 00 00 39 38 38 38 64 2f 2f 2e 39 00 00 a8 ae 00 00 00 06 cd ca 00 00 00 00 00 00 00 00 00 01 00 00
2020-06-05 20:45:06,894,894 DEBUG    [ac_db.py:534] AcInfo: 00100001 11100000 00100000 00000000 00000000 00000000 00111001 00111000 00111000 00111000 01100100 00101111 00101111 00101110 00111001 00000000 00000000 10101000 10101110 00000000 00000000 00000000 00000110 11001101 11001010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000
2020-06-05 20:45:07,181,181 DEBUG    [ac_db.py:573] 00000000 00000001 00010001 01000111 00100101 00000000 01100000 00000000 00100000 00000000 00000000 00000000 00000000 00010000 00000000 00000000 11010110 01001000 11111010 00011101 11100001 11000100 10010100
2020-06-05 20:45:07,182,182 DEBUG    [ac_db.py:577] bb 00 07 00 00 00 0f 00 01 11 47 25 00 60 00 20 00 00 00 00 10 00 00 d6 48 fa 1d e1 c4 94
2020-06-05 20:45:11,499,499 DEBUG    [monitor.py:239] publishing on topic "homeassistant/climate/c8f7429c8539/config", data "{"fan_mode_command_topic": "/aircon/c8f7429c8539/fanspeed_homeassistant/set", "action_topic": "/aircon/c8f7429c8539/homeassistant/set", "precision": 0.5, "temperature_state_topic": "/aircon/c8f7429c8539/temp/value", "mode_command_topic": "/aircon/c8f7429c8539/mode_homeassistant/set", "min_temp": 16.0, "modes": ["off", "cool", "heat", "fan_only", "dry"], "current_temperature_topic": "/aircon/c8f7429c8539/ambient_temp/value", "name": "", "fan_modes": ["Auto", "Low", "Medium", "High"], "mode_state_topic": "/aircon/c8f7429c8539/mode_homeassistant/value", "temperature_command_topic": "/aircon/c8f7429c8539/temp/set", "fan_mode_state_topic": "/aircon/c8f7429c8539/fanspeed_homeassistant/value", "max_temp": 32.0}"
2020-06-05 20:45:11,505,505 DEBUG    [monitor.py:239] publishing on topic "/aircon/c8f7429c8539/fixation_v/value", data "AUTO"
2020-06-05 20:45:11,507,507 DEBUG    [monitor.py:239] publishing on topic "/aircon/c8f7429c8539/mildew/value", data "OFF"

If you use serving like MQTT Explorer to have a look as your MQTT topics, do you see the info from monitor appearing? Do you also see climate devices appearing in the homeassistant topic?

Another thing to check is the autodiscovery topic in HA matches your monitor.py config.yml

What Do You mean written:
“Another thing to check is the autodiscovery topic in HA matches your monitor.py config.yml”

What exactly should I check? I am newbie in HomeAssistant so I need more knowlegde😉

oh sure.
So in your configuration.yaml in Home-Assistant you should have something like the following:

mqtt:
  broker: !secret mqtt_host
  username: !secret mqtt_username
  password: !secret mqtt_password
  discovery: true
  discovery_prefix: homeassistant

The important part here is the discovery_prefix. This must match what you have as the auto_discovery_topic line in your config.yml file within the broadlink_ac_mqtt folder.
Liike this:

mqtt:
    host: <mqtt_host>
    port: 1883
    client_id: ac_to_mqtt
    user: 
    passwd: 
    topic_prefix: /aircon
    auto_discovery_topic: homeassistant

If you’re still stuck, head on over to the discord we created for this and you can find me there. https://discord.gg/AeNFy2

Hello all!
What is the best option to run Monitor.py script at boot time?
Thanks