Broadlink Switch display

As far as I know, HASS does not do well with saving states. It doesn’t like to assume anything. When you restart, it will lose whatever you sent last. I have the same issue with my TV power.

Therein lies the big problem with Broadlink controlled RF devices. Worth replacing anything that really matters what the state is with wifi, direct or via mqtt, controlled devices which will report state and sort themselves out when restarting HA. The ubiquitous Sonoff Basics with Tasmota are probably cheaper than the dumb device you’d be replacing.

Hey Wheezy,

Can’t thank you enough for sharing your code, Im just getting started with home assistant and you saved me a whole bunch of time and frustration.

Can you please show the config behind the group.sensor_node_1_card & group.sensor_node_2_card entries? I would like to get the temps in a card rather than the bubbles.

Thanks!

Dave

Hi

I worked out how to do the sensors in a card but Im having problems getting the switches to show up in there own card, any ideas? The temps show up fine but the switches do not, nor do they appear grouped in the main view.

Thank you

configuration.yaml

  - platform: broadlink
    host: 10.0.0.62
    mac: 'editedforprivacy'
    friendly_name: 'Living Room'
    timeout: 200
    switches:
      living_ac_23:
        friendly_name: "Living Room 23"
        command_on: 'JgAGAWs0Dw0QCg4nEAsPJxAKDgwQDA4nDygNDBELDQ0OJxAnDQ0PCw8NDgwODA4NDgwPDQ4MDwwPDA8LDwwPKA0MDwwODQ8MDg0NDQ4MECcNDg8KDwwQCw8nDicPKA0nDyYQJw4nDicPDQ4LECYODA8MDwwODQ4MDw0NDQ8LDygNKQ0MDwwOJw8MEAsQCxAlDygNJw8MDg0ODBALDg0QCg8NDg0NDQ4NDgwQDA4MDikOCw4ODQ0ODQ4NDQ0QDA0NDQ0PCxAMDgwODg0ODQwPDQ0MEQwNDA8NDgsRCg8MEAsPDA8LDw0ODA4MEAsQCxALDicPDBALDyYPJhAnDScPDBAmEAsODA8ADQUAAA====='
        command_off: 'JgB2AG00DwwPDA4oDgsPJw4MDwwQCw8mECYODg4LDwwOKA4nDwwPCw8MDg0QCw8NDQwPDA4NDwwODQ0NDwsPJw4NDwsQCw8MDgwPDQ4MDyYPDBALDg0QDA0nDg4NDA8NDwsQCw4NDicPCw8nECUQJg4nDycOKA4ADQUAAA====='
      living_ac_24:
        friendly_name: "Living Room 24"
        command_on: 'JgAGAW0zDg4OCw8nEAwOJg4NDwwODg4mDicPDQ4MEAoPKA0nDwwPDA8NDQwPDA4ODwoRCg8MDg0PDQ0MDg0PJg8MDwwPCw8MEAsODQ8MDicODQ4ODQ0ODQ4mECYOKQ4nDScPJw4nDycODA8MDikNDQ4MDg4NDA8NDgwODQ4NDigPJw0MDwwPJg8NDQ4OCw8NDg0ODA4oDwsPDQ0MDwwODg4NDQ4NDA8MEAoPDQ4MDyYQCw8MDg0PDQ0MDwwODg0MDw0ODQ0NDgwPDQ0NDgwPDA8MDg0PDQ4MDQ4NDQ8LDw0NDQ4MDw0ODA8MDgwQCw8MDicPDA8MECYOJw8nDicOJxANDQwODg0ADQUAAA====='
        command_off: 'JgB2AG00DwwPDA4oDgsPJw4MDwwQCw8mECYODg4LDwwOKA4nDwwPCw8MDg0QCw8NDQwPDA4NDwwODQ0NDwsPJw4NDwsQCw8MDgwPDQ4MDyYPDBALDg0QDA0nDg4NDA8NDwsQCw4NDicPCw8nECUQJg4nDycOKA4ADQUAAA====='
  - platform: broadlink
    host: 10.0.0.250
    mac: 'editedforprivacy'
    friendly_name: 'Bedroom'
    timeout: 200
    switches:
      bedroom_ac_23:
        friendly_name: "Bedroom 23"
        command_on: 'JgAGAWs0Dw0QCg4nEAsPJxAKDgwQDA4nDygNDBELDQ0OJxAnDQ0PCw8NDgwODA4NDgwPDQ4MDwwPDA8LDwwPKA0MDwwODQ8MDg0NDQ4MECcNDg8KDwwQCw8nDicPKA0nDyYQJw4nDicPDQ4LECYODA8MDwwODQ4MDw0NDQ8LDygNKQ0MDwwOJw8MEAsQCxAlDygNJw8MDg0ODBALDg0QCg8NDg0NDQ4NDgwQDA4MDikOCw4ODQ0ODQ4NDQ0QDA0NDQ0PCxAMDgwODg0ODQwPDQ0MEQwNDA8NDgsRCg8MEAsPDA8LDw0ODA4MEAsQCxALDicPDBALDyYPJhAnDScPDBAmEAsODA8ADQUAAA====='
        command_off: 'JgB2AG00DwwPDA4oDgsPJw4MDwwQCw8mECYODg4LDwwOKA4nDwwPCw8MDg0QCw8NDQwPDA4NDwwODQ0NDwsPJw4NDwsQCw8MDgwPDQ4MDyYPDBALDg0QDA0nDg4NDA8NDwsQCw4NDicPCw8nECUQJg4nDycOKA4ADQUAAA====='
      bedroom_ac_24:
        friendly_name: "Bedroom 24"
        command_on: 'JgAGAW0zDg4OCw8nEAwOJg4NDwwODg4mDicPDQ4MEAoPKA0nDwwPDA8NDQwPDA4ODwoRCg8MDg0PDQ0MDg0PJg8MDwwPCw8MEAsODQ8MDicODQ4ODQ0ODQ4mECYOKQ4nDScPJw4nDycODA8MDikNDQ4MDg4NDA8NDgwODQ4NDigPJw0MDwwPJg8NDQ4OCw8NDg0ODA4oDwsPDQ0MDwwODg4NDQ4NDA8MEAoPDQ4MDyYQCw8MDg0PDQ0MDwwODg0MDw0ODQ0NDgwPDQ0NDgwPDA8MDg0PDQ4MDQ4NDQ8LDw0NDQ4MDw0ODA8MDgwQCw8MDicPDA8MECYOJw8nDicOJxANDQwODg0ADQUAAA====='
        command_off: 'JgB2AG00DwwPDA4oDgsPJw4MDwwQCw8mECYODg4LDwwOKA4nDwwPCw8MDg0QCw8NDQwPDA4NDwwODQ0NDwsPJw4NDwsQCw8MDgwPDQ4MDyYPDBALDg0QDA0nDg4NDA8NDwsQCw4NDicPCw8nECUQJg4nDycOKA4ADQUAAA====='

groups.yaml

AC_view:
  view: yes
  name: Climate Control
  entities:
    - group.temps
    - group.aircon
    - weather.bom_perth
temps:
  name: Temps
  entities:
    # - weather.bom_perth.temperature
    # - weather.bom_perth.humidity
    # - sun.sun.next_setting
    - sensor.broadlink_sensor_temperature_2
    - sensor.broadlink_sensor_temperature
    - sensor.temperature_158d0001fa6d07
aircon:
  entities:
    - switch.living_ac_23
    - switch.living_ac_24
    - switch.bedroom_ac_23
    - switch.bedroom_ac_24

hi wheezy,

I have android tv and setup the on and off my tv with RM MIN3 via home assistant…but i directly want to start youtube and my remote dont have dedicated youtube button…after start my tv i have to push HOME button thane twice down and twice right button than select youtube app and than ok button so how can I send this packets to my tv?
Please help.

Thanks,

Ashish Chauhan.

Hey, sorry this took so long. I haven’t been checking the forums lately

I use the BRUH Multisensor nodes. This is the pertinent section, but I think you want the whole code package. Here are the groups.

group:
  sensor_node_1_card:  
    name: Livingroom
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - sensor.sn1_pir  
      - light.sn1_led
  sensor_node_2_card:  
    name: Bedroom
    entities:  
      - sensor.sn2_temperature  
      - sensor.sn2_humidity  
      - sensor.sn2_ldr  
      - sensor.sn2_pir  
      - light.sn2_led

Here is the code package that I invoke inside my configuration.yaml using

homeassistant:
  packages: 
    pack_1: !include custom_components/bruh_multisensors_package.yaml

\HASSIO\config\custom_components\bruh_multisensors_package.yaml

homeassistant:
  customize:
    #Multisensor component names & icons
    sensor.sn1_temperature:
        friendly_name: "Temp"
    sensor.sn1_humidity:
        friendly_name: "Humidity"
    sensor.sn1_ldr:
        friendly_name: "Luminance"
    sensor.sn1_pir:
        friendly_name: "Motion"
    light.sn1_led:
        friendly_name: "LED"
    sensor.sn2_temperature:
        friendly_name: "Temp"
    sensor.sn2_humidity:
        friendly_name: "Humidity"
    sensor.sn2_ldr:
        friendly_name: "Luminance"
    sensor.sn2_pir:
        friendly_name: "Motion"
    light.sn2_led:
        friendly_name: "LED"
        
light:
  #BRUH Multisensor Node LED's
  - platform: mqtt_json
    name: "SN1 LED"
    state_topic: "bruh/sensornode1"
    command_topic: "bruh/sensornode1/set"
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0
  - platform: mqtt_json
    name: "SN2 LED"
    state_topic: "bruh/sensornode2"
    command_topic: "bruh/sensornode2/set"
    brightness: true
    flash: true
    rgb: true
    optimistic: false
    qos: 0
    
sensor:
  #BRUH Multisensor Node sensors (values from MQTT)
  #  Note: These sensors have not been calibrated.  Calibration values could be perturbed here at a later date.  These LUX sensors have +/-20units difference between eachother under identical conditions.
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 Humidity"  
    unit_of_measurement: "%"  
    value_template: '{{ value_json.humidity | round(1) }}'  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 LDR"
    ##This sensor is not calibrated to actual LUX. Rather, this a map of the input voltage ranging from 0 - 1023.
    unit_of_measurement: "units"  
    value_template: '{{ value_json.ldr }}'  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 PIR"  
    value_template: '{{ value_json.motion }}'  
  - platform: mqtt  
    state_topic: "bruh/sensornode1"  
    name: "SN1 Temperature"  
    unit_of_measurement: "F"  
    value_template: '{{ value_json.temperature | round(1) }}'
    
    
  - platform: mqtt  
    state_topic: "bruh/sensornode2"  
    name: "SN2 Humidity"  
    unit_of_measurement: "%"  
    value_template: '{{ value_json.humidity | round(1) }}'  
  - platform: mqtt  
    state_topic: "bruh/sensornode2"  
    name: "SN2 LDR"
    ##This sensor is not calibrated to actual LUX. Rather, this a map of the input voltage ranging from 0 - 1023.
    unit_of_measurement: "units"  
    value_template: '{{ value_json.ldr }}'  
  - platform: mqtt  
    state_topic: "bruh/sensornode2"  
    name: "SN2 PIR"  
    value_template: '{{ value_json.motion }}'  
  - platform: mqtt  
    state_topic: "bruh/sensornode2"  
    name: "SN2 Temperature"  
    unit_of_measurement: "F"  
    value_template: '{{ value_json.temperature | round(1) }}'  
    
# binary_sensor (This is absolutely required for "template_last_motion" to work for some reason)
#  https://home-assistant.io/docs/z-wave/entities/#binary-sensor
binary_sensor:
  - platform: template
    sensors:
      sn1_pir:
        value_template: >-
          {%- if is_state('sensor.sn1_pir', "motion detected") -%}
          true
          {%- else -%}
          false
          {%- endif -%}
      sn2_pir:
        value_template: >-
          {%- if is_state('sensor.sn2_pir', "motion detected") -%}
          true
          {%- else -%}
          false
          {%- endif -%}

    
group:
  sensor_node_1_card:  
    name: Livingroom
    entities:  
      - sensor.sn1_temperature  
      - sensor.sn1_humidity  
      - sensor.sn1_ldr  
      - sensor.sn1_pir  
      - light.sn1_led
  sensor_node_2_card:  
    name: Bedroom
    entities:  
      - sensor.sn2_temperature  
      - sensor.sn2_humidity  
      - sensor.sn2_ldr  
      - sensor.sn2_pir  
      - light.sn2_led

You might be able to do this using a the Broadlink RM component’s broadlink_send_packet command. You could set up a series of broadlink_send_packet commands inside a script.

Yes, I agree with the other two posters. I frequently refer to my own IR blasters as “dumb fire” tech: My IR-controlled space heaters sometimes get put into an incorrect state because one didn’t sense the IR command from the Broadlink blaster. This results in HomeAssistant dutifully marking the heaters as “off” after it fired the “off” command, but one heater staying on anyway on accident. From then on, my states are opposite in HomeAssistant from what they should be in real life. It doesn’t happen a lot, but it’s annoying.

My MQTT/wifi/smart switches (not IR) are smarter than that though since they report back to HomeAssistant to tell HomeAssistant their current state at any given moment. So HomeAssistant doesn’t get confused with those “smarter” devices.

Thanks heaps for that! I have the parts for the Bruh sensor on the way so this is really useful.

I’m having the exact same issue as the original poster, but it’s unclear whether they solved the problem or not.

I have setup the config according to the Broadlink components page (as well as all your working configs in this thread) but the switches are not showing up on the States page or in the frontend.

My log:

2018-04-18 23:54:30 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2018-04-18 23:54:53 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/switch/broadlink.py”, line 157, in setup_platform
device_config.get(CONF_COMMAND_OFF)
File “/usr/lib/python3.6/site-packages/homeassistant/components/switch/broadlink.py”, line 193, in init
self._command_on = b64decode(command_on) if command_on else None
File “/usr/lib/python3.6/base64.py”, line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

My config:

  - platform: broadlink
    host: 192.168.1.xx
    mac: 'xxxxxxxxx'
    switches:
      wardrobe_aircon:
        friendly_name: "Wardrobe Aircon"
        command_on: 'JgBQAhAMEQwQDBAMEQwQAANAdDYRKBELEQwQDBEoEAwRCxEMEAwRKBAMESgQKRAMECkQKBEoECkQKBEMEAwRKBAMEQsRDBAMEQsRDBAMEQsRDBAMESgQDBEoEAwRDBAMECkQKBEMEAwQDBEMEAwRCxEMEAwRCxEMEAwRCxEMEAwRDBAMECkQKBEoEAwRKBAMESgQKRAABHZ0NhEoEAwRDBAJEykQDBANEAwQDBApEAwRKBApEAwQKRAoESgQKRAoEQwQDBApEAwQDBEMEAkTDRAMEAwQDRAMEAwRDBAoEQwQDBAMEQwQKBEMEAwQDBEMEAwQDBEMEAwQDBEMEAwRCxEMEAwRDBAMEAwRDBAMECkQDBApEAwQKRAMEAAEd3M3ECgRDBAMEQsRKBELEQwQDBELESgRDBAoESgQDBEoECkQKBEoESgQDBELESgRCxEMEAwRDBAMEAwRDBAMEAwRDBAMEAwRDBAMEAwRDBAMEAwRDBAMEAwRKBELESgRCxEMEAwRCxEMEAwRCxEMECkQKBEMEAwQDBEMEAwQDBEMEAwQDBEMEAwQDBEMECgRDBAoEQwQDBELEQwQDBEMEAwQDBEMEAwQDBEMEAwQDBEMEAwQDBEoECkQDBELEQwQDBELEQwQDBELEQwQDBEoECkQDBAMEQwQDBAMEQwQDBAMEQwQDBAMEQwQDBAMEQwQDBELEQwQDBELEQwQDBELESgRKBAMEQwQDBAMEQwQDBAMEQwQDBApEAwQDBEMEAwRCxEMEAwQKRAMEQsRDBAMESgQKRAADQUAAAAAAAAAAA'
        command_off: 'JgBQAhELEAwRDBAMEAwRAANAcjgPKg8NDg4PDg4rDw0ODg4PDg4OKw8NDisPKQ8ODioPKg8qDykPKg8NDw4OKw8NDg4ODw4ODg4ODw4ODg4ODw4ODisPDQ4rDw0ODg8ODioPKg8NDw4ODg4ODw4ODg4ODw4ODg4PDg4ODg4PDg4ODg4PDioPKg8qDw0OKw8NDisPKg4ABHh0NhEoEQsRCxILESgRCxELEQwRCxEoEQsRKBEnEQwRJxInESgRKBEnEQsSCxEoEQsQDBANEQsQDBANEQsQDBANEQsQDBApEQsQDRELEQsSJxELEgsRCxEMEAwRCxEMEQsRCxEMEAwRCxEMEQsQDBEMEQsRCxEMEScRDBEnEQwRKBELEQAEdXU1ESgRCxEMEQsQKRELEQwRCxAMESgRCxApECkQDBApECgQKRApECkPDQ4ODisODg4PDg4ODg4PDg4ODg4PDg4ODg4PDg4ODg8ODg4ODg8ODg4OKw4ODg4PKg4ODyoODw4ODg4ODw4ODg4ODw4ODisOKg8ODg4ODg8ODw0ODhANEAwQDBANEAwQDBEMECkPDRApEAwQDBANEAwQDBANEAwQDBANEAwQDBANEAwRCxANEAwRCxEoESgRCxELEQwRCxELEQwRCxEMEQsRCxEoESgRCxELEQwRCxELEQwRCxELEQwRCxELEQwRCxELEgsRCxELEgsRCxEMEQsRCxEMEScRKBELEQwRCxELEQwRCxELEQwRCxEoEQsRCxEMEQsRCxILESgRJxEMEQsRCxEMEScRKBEADQUAAAAAAAAAAA'

Update, in case it is useful for others having the same issue:

I fixed it by adding “===” to the end of my commands.

This is my config, it works properly for me. I also added one = character to the end of my commands:

Interesting, because one “=” wouldn’t work for me. The switches would disappear from the front-end and my log would error out.

the ‘=’ characters are placeholders. the code has to be in even blocks of 16 bits (i think…or maybe 64…whatever…). you need to add different numbers of those to make the code come out evenly. some will use one, others two, etc.

It may also be by action of the assumed_state: false setting under each switch’s homeassistant: customize: custom display field.

Yes, I can confirm. Setting assumed_state: false in customize file changes the lightning bolt to toggle. Thanks for this.