Broadlink Switch display

Here my config

  - platform: broadlink
    host: 192.168.1.8
    mac: 'xxxxxxxx'
    name: 'bedroom'
    timeout: 200
    switches:
      led_red:
        friendly_name: "Red LED"
        command_on: 'JgBQAAABJ5QSExEUERQRFBIUERMSFBEUETgROBI4ETgRFBE4EjgROBEUERQSNxIUERQRFBEUERQROBI4ERQROBE4EjgROBE4EgAFQgABJkoSAA0FAAAAAAAAAAA='
        command_off: 'JgBYAAABJ5QUERMSEhQSExITEhMSExMSEzcSNxI3EjgRFBI3EzcSNxITEjgRFBEUERQSExITExISOBITETgTNxE4EjcTNxE4EgAFQgABJ0oSAAxQAAEmShIADQU='
      blue_led:
        friendly_name: "Blue Led"
        command_on: 'JgBQAAABJ5QTExITERQSExITERQSExMSEzcROBE4EzcSExE4EzYTNxEUEjcSOBEUEhMSExITERQSNxIUERQSNxI3EjgSNxI3EgAFQgABKEkSAA0FAAAAAAAAAAA='
        command_off: 'JgBQAAABJ5QTExITERQSExITERQSExMSEzcROBE4EzcSExE4EzYTNxEUEjcSOBEUEhMSExITERQSNxIUERQSNxI3EjgSNxI3EgAFQgABKEkSAA0FAAAAAAAAAAA='
      green_led:
        friendly_name: "Green LED"
        command_on: 'JgBYAAABJ5USExITEhMSExMSEhQRFBEUEjcTNxI3EjcTExE4EjcTNxI3EhMSNxMTERQRFBITEhMSExI4EhMSNxM3EjcSNxM3EQAFQwABJ0oSAAxQAAEnShIADQU='
        command_off: 'JgBQAAABJJMSEhISETgSEhITEBMSEhMSETcSNxMREjcSNxI3EjcSOBETERITNhM2EhITERM2EzcRNxI3ExISEhI3EjcRExETEgAFLQABJEoRAA0FAAAAAAAAAAA='
      light1_livingroom:
        friendly_name: "Livingroom Down Lights"
        command_on: 'slA0AA0iDSINIg0iDSIkCw0iJAsNIg0iDSINIg0iDSINIiQLDSINIg0iJAsNIiQLDSIkCw0AAUUAAAAA='
        command_off: 'sjc0AA0iDSINIg0iDCMkCw0iJAsNIg0iDSINIg0iDSINIiMLDSINIg0iJAsNIiQLDSINIg0AAUUAAAAA='
      livingroom_led_power:
        friendly_name: "Livingroom LED Power"
        command_on: 'slE0AA0jDCINIw0jDSIkDA0iJAwNIyQMDSINIg0iDSINIiQMDCMNIw0iJAwNIyQMDSIkDAwAAUQAAAAA='
        command_off: 'sk00AAwjDSMNIwwjDCMjDAwjIwwMIyMMDCMMIwwjDCMMIyMMDCMNIwwjIwwNIyQMDCMMIwwAAUUAAAAA='
      kitchen_led_power:
        friendly_name: "Kitchen LED Power"
        command_on: 'slE0AA0iDSINIg0iDSIkCw0iJAwNIw0iDSMkCw0jDSMNIiQMDSMNIg0iJAsNIiQLDSIkDA0AAUUAAAAA='
        command_off: 'sjs0AAwjDCMNIw0jDCMkDA0jIwwMIwwjDCMjDAwjDCMMIyMMDCMMIwwjIwwMIyMMDCMMIwwAAUUAAAAA='

This is my config. I had same problem all i did was add = <- Equals symbol to end of each command on and command off and then the switches would show up in my frontend.

1 Like

I was organizing my IR buttons into scripts so that they wouldn’t be switches and I realized you might be able to bypass the whole “switches not showing up” thing if you ran scripts using the “send_packet” command example from the broadlink component page.

script:
  tv_select_source:
    sequence:
      - service: broadlink.send_packet_192_168_0_107
        data:
          packet: 
            - "JgCMAJSSFDYUNhQ2FBEUERQRFBEUERQ2FDYUNhQRFBEUERQRFBEUERQRFDYUERQRFBEUERQRFDYUNhQRFDYUNhQ2FDYUNhQABfWUkhQ2FDYUNhQRFBEUERQRFBEUNhQ2FDYUERQRFBEUERQRFBEUERQ2FBEUERQRFBEUERQ2FDYUERQ2FDYUNhQ2FDYUAA0FAAAAAAAAAAAAAAAA"

I wanted to clean up my IR blaster HASS dashboard buttons anyway by making scripts to trigger the switches, since I think it looks nicer. If you want to try that, read on – if not, no worries :slight_smile: I just got excited and wanted to post my setup below:

=======================================
Making broadlink switches into grouped scripts:

Code for my switches (re-posted with new variable names):

switch:
  #Broadlink "RM mini 3" IR Transciever
  - platform: broadlink
    # type: rm_mini
    timeout: 15
    host: 192.168.1.12
    mac: '34:EA:34:B2:F0:E5'
    switches:
      ac_power:
        friendly_name: "AC Power"
        command_on: 'JgBoAAABJJQSNxETEhMRExITERMSExE4ERMSNxI3EhMRExI3EjgRExE4EhMRExITERMSExETEjcSExE4ETgROBE4ETgROBITEQAFZgABI0sRAAxAAAEjSxEADD8AASRKEgAMPwABI0sRAA0F'
        command_off: 'JgBoAAABJJQSNxETEhMRExITERMSExE4ERMSNxI3EhMRExI3EjgRExE4EhMRExITERMSExETEjcSExE4ETgROBE4ETgROBITEQAFZgABI0sRAAxAAAEjSxEADD8AASRKEgAMPwABI0sRAA0F'
      ac_temp_up:
        friendly_name: "AC Temp Up"
        command_on: 'JgBYAAABJpEUNRQRFBAUERQRExEUERM2ExEUNRQ1FBETERQ1FDUUERM2FBAUNRQRFBAUERQREzYTERQ1FBETNhM2EzYTNhMRFAAFZAABJUkTAAw9AAEmSBQADQU='
      ac_temp_down:
        friendly_name: "AC Temp Down"
        command_on: 'JgBQAAABJZIUNRQRExEUERMRFBETERQ1FBETNhQ1FBETERQ1FDUUERMRFDUUERM2ExEUERMRFDUUNhMRFDUUERM2EzYTNhMRFAAFZAABJUkTAA0FAAAAAAAAAAA='
      ac_fan_speed:
        #Cycles through three available fan speeds when pressed repeatedly
        friendly_name: "AC Fan Speed"
        command_on: 'JgBQAAABJZIUNRQRExEUERMRFBEUERM2ExEUNRQ1FBETERQ1FDUUERM2ExEUERQ1FDUUERMRFDUUERM2EzYTERQREzYTNhMRFAAFZAABJUkTAA0FAAAAAAAAAAA='
      ac_mode:
        friendly_name: "AC Mode"
        command_on: 'JgCAAAABJpEUNhMRFBETERQRExEUERM2ExEUNRQ1FBETERQ1FDYTERQ1FDUUERM2EzYTERQREzYTERQREzYTEhMREzYTNhMSEwAFYwABJkkUAAw9AAElSRMADD4AASVJEwAMPgABJUkTAAw9AAEmSRMADD0AASZIFAAMPQABJkgUAA0FAAAAAAAAAAA='
      ac_timer:
        #Timer goes up to 24 when pressed repeatedly
        friendly_name: "AC Timer"
        command_on: 'JgB4AAABJZEUNhMRFBETERQRExEUERM2ExEUNRQ1FBETEhM2EzYTERQ1FDUUNRQ1FDUUERMRFDUUERQRExEUERMRFDUUNRQREwAFZQABJUgUAAw8AAEmSRMADD0AASZJEwAMPQABJkgUAAw9AAElSRMADD4AASVIFAANBQ=='

      livingroom_amp_power:
        friendly_name: "Livingroom Amp Power"
        command_on: 'JgCoAFASKBIWESkRFhEpEhUSFhEWERYRFhIVEigAA0tQEikRFhIoEhUSKREVEhUTFRIVEhUSFRMnAANMTxMoEhUSKBIVEygSFRIVEhUTFBMVEhUSKAADTE8TJxMVEigSFRIoExQTFRIVEhUSFRMVEigAA0tPEygSFRMoEhUSKREWERYSFRIWERYRFhEpAANLUBIoEhYRKREWEigSFhEWERYRFhIVEhYRKQANBQ=='
        command_off: 'JgCoAFASKBIWESkRFhEpEhUSFhEWERYRFhIVEigAA0tQEikRFhIoEhUSKREVEhUTFRIVEhUSFRMnAANMTxMoEhUSKBIVEygSFRIVEhUTFBMVEhUSKAADTE8TJxMVEigSFRIoExQTFRIVEhUSFRMVEigAA0tPEygSFRMoEhUSKREWERYSFRIWERYRFhEpAANLUBIoEhYRKREWEigSFhEWERYRFhIVEhYRKQANBQ=='
      livingroom_amp_vol_up:
        friendly_name: "Livingroom Amp Vol Up"
        command_on: 'JgCMAE8TFRIoEhUSFRMoEhUSFRIVExQTFRIVEigAA19PEhUTKBIVEhUSKBMUExUSFRIVEhUTFBMoAANeTxMVEigTFBMVEigSFRIVExQTFRIVEhUSKAADX08TFBMoEhQTFRMnExQTFRIUExQUFBMUEygAA19PEhUTJxMVEhUSKBIVExQTFRIVEhUTFBMnAA0FAAAAAAAAAAAAAAAA'
      livingroom_amp_vol_down:
        friendly_name: "Livingroom Amp Vol Down"
        command_on: 'JgCMAFASKBMoEhUSFRIoEhUTFBMVEhUSFRIVEygAA0tPEygSKBIVExUSKBIVEhUSFRMVEhUSFRIoAANMTxMoEigSFRIVEigTFRIVEhUSFRMUExUSKAADS1ASKBMnExUSFRIoEhUTFBMVEhUSFRIUFCgAA0tPEygSKBIVExUSKBIVEhUSFRMVEhUSFRIoAA0FAAAAAAAAAAAAAAAA'
      livingroom_amp_bass_boost_eq:
        friendly_name: "Livingroom Amp Bass Boost EQ"
        command_on: 'JgCqAE8TKBIVEigTJxMVEhUSKBIVExQTFRIVEigSFRMVEigAArBPEygSFRIoEigSFRMUEygSFRIVEhUTFRIoEhUSFRMnAAKwUBIoExQTKBIoEhUSFRMnExUSFRIVEhUTKBIVEhUSKAACsE8TKBIVEigTJxMVEhUSKBIVExQTFRIVEigSFRMVEigAArBPEygSFRIoEigSFRMVEigSFRIVEhUTFRIoEhUSFRMnAA0FAAAAAAAAAAAAAAAAAAA='

I made scripts to trigger my switches, so that there’s an “activate” button instead of toggles or on/off buttons. You could just do the send_packet thing here instead.

script:
  #These IR scripts are written so that HASS dashboard will display a one-shot "activate" button for these 'dumbfire' IR blasts (instead of a displaying a toggle for a smartdevice, which would falsely imply a known state of on/off for each action)
  ac_temp_up:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_temp_up
  ac_temp_down:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_temp_down
  ac_fan_speed:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_fan_speed
  ac_mode:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_mode
  ac_timer:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_timer
  livingroom_amp_vol_up:
    sequence:
      - service: switch.turn_on
        entity_id: switch.livingroom_amp_vol_up
  livingroom_amp_vol_down:
    sequence:
      - service: switch.turn_on
        entity_id: switch.livingroom_amp_vol_down
  livingroom_amp_bass_boost_eq:
    sequence:
      - service: switch.turn_on
        entity_id: switch.livingroom_amp_bass_boost_eq

Bonus round: Customize icons + hide any extra unused switches:

  customize:
    switch.ac_power:
        friendly_name: "Power"
        icon: mdi:power
        assumed_state: false        
    script.ac_temp_up:
        friendly_name: "Temp up"
        icon: mdi:thermometer-lines
    script.ac_temp_down:
        friendly_name: "Temp down"
        icon: mdi:snowflake
    script.ac_fan_speed:
        friendly_name: "Fan speed"
        icon: mdi:fan
    script.ac_mode:
        friendly_name: "Mode"
        icon: mdi:settings-box
    script.ac_timer:
        friendly_name: "Timer"
        icon: mdi:av-timer

    switch.livingroom_amp_power:
        friendly_name: "Power"
        icon: mdi:power
        assumed_state: false
    script.livingroom_amp_vol_up:
        friendly_name: "Vol up"
        icon: mdi:volume-plus
    script.livingroom_amp_vol_down:
        friendly_name: "Vol down"
        icon: mdi:volume-minus
    script.livingroom_amp_bass_boost_eq:
        friendly_name: "Bass boost EQ"
        icon: mdi:speaker-wireless

    #Hidden items
    switch.ac_temp_up:
        icon: mdi:thermometer-lines
        assumed_state: false
        hidden: true
    switch.ac_temp_down:
        icon: mdi:snowflake
        assumed_state: false
        hidden: true
    switch.ac_fan_speed:
        icon: mdi:fan
        assumed_state: false
        hidden: true
    switch.ac_mode:
        icon: mdi:settings-box
        assumed_state: false
        hidden: true
    switch.ac_timer:
        icon: mdi:av-timer
        assumed_state: false
        hidden: true
    switch.livingroom_amp_vol_up:
        icon: mdi:volume-plus
        assumed_state: false
        hidden: true
    switch.livingroom_amp_vol_down:
        icon: mdi:volume-minus
        assumed_state: false
        hidden: true
    switch.livingroom_amp_bass_boost_eq:
        icon: mdi:speaker-wireless
        assumed_state: false
        hidden: true

2 Likes

[quote=“robertpe, post:5, topic:18895”]
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/base64.py”, line 87, in b64decode
return binascii.a2b_base64(s)

binascii.Error: Incorrect padding[/quote]

[quote=“aimwarlock, post:9, topic:18895”]
I had same problem all i did was add = … Equals symbol to end of each command on and command off and then the switches would show up in my frontend.[/quote]

I may have gotten carried away. I re-read your post and it sounds like there could be a problem with the formatting of your capture code? Try capturing some new codes and ensure they’re in base64 ? (you already mentioned you found the capture service via: HomeAssistant > Developer Tools > Services > “Domain:” broadlink , “Service:” learn_command_192_168_1_xx , but just making sure you’re using that one).

Another thing it could be: I learned by accident that variables cannot have capital letters in them. Maybe try changing “thing”/“item”/“variable” names, like CONF_COMMAND_OFF, to lowercase.

I’d like to see your code too

1 Like

@Wheezy

How did you get your A/C power & livingroom speaker amp power controls to be toggles instead of the default lightning bolts?

I don’t see any icon customizations for those.

It’s all here…

RTFM as they say :grin:

Good question!

Hm, I can’t remember, but here’s all my code including groups and views if that helps (see All IR Blaster Code: below). I forgot to post the groups and views code above, so maybe the fact that I’ve grouped them makes HASS do this slider action instead of lightning bolts? It may also be by action of the assumed_state: false setting under each switch’s homeassistant: customize: custom display field.

A note on making single-shot “ACTIVATE” buttons though (I accidentally wrote this paragraph and then realized you probably meant those jelly bean sliders, not the activate buttons, and I also realized I already wrote about this haha, but I’m just gonna post this info anyway since this time I wrote a cleaner post): Since the broadlink creates a switch for every IR command (one command is the “on” switch, another command or the same command can be the “off” side of the switch), I created separate scripts that trigger the “on” of each Broadlink-made switch. It’s redundant code, and cumbersome to implement. I wish the Broadlink component had an easier workaround for this (I know you can just create scripts that fire IR codes, but I like to see all variable collected under the Broadlink component in my YAML, so I still use the switches).

.
Sample code for one-shot buttons that say “ACTIVATE”:

homeassistant:
  customize:
    script.ac_temp_up:
        friendly_name: "Temp up"

switch:
  - platform: broadlink
    # type: rm_mini
    timeout: 15
    host: 192.168.1.12
    mac: 'xx:xx:xx:xx:xx:xx'
    switches:
      ac_temp_up:
        friendly_name: "AC Temp Up"
        command_on: 'JgBYAAABJpEUNRQRFBAUERQRExEUERM2ExEUNRQ1FBETERQ1FDUUERM2FBAUNRQRFBAUERQREzYTERQ1FBETNhM2EzYTNhMRFAAFZAABJUkTAAw9AAEmSBQADQU====='

script:
  ac_temp_up:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_temp_up

group:
  ac_remote:
    name: "Air Conditioner"
    control: hidden
    entities:
     - switch.ac_power
     - script.ac_temp_up
     - script.ac_temp_down
     - script.ac_fan_speed
     - script.ac_mode
     - script.ac_timer

.

All IR Blaster Code:

homeassistant:
  customize:
    #AC Unit button names & icons
    switch.ac_power:
        friendly_name: "Power"
        icon: mdi:power
        assumed_state: false        
    script.ac_temp_up:
        friendly_name: "Temp up"
        icon: mdi:thermometer-lines
    script.ac_temp_down:
        friendly_name: "Temp down"
        icon: mdi:snowflake
    script.ac_fan_speed:
        friendly_name: "Fan speed"
        icon: mdi:fan
    script.ac_mode:
        friendly_name: "Mode"
        icon: mdi:settings-box
    script.ac_timer:
        friendly_name: "Timer"
        icon: mdi:av-timer

    #Livingroom Stereo Amp button names & icons
    switch.livingroom_amp_power:
        friendly_name: "Power"
        icon: mdi:power
        assumed_state: false
    script.livingroom_amp_vol_up:
        friendly_name: "Vol up"
        icon: mdi:volume-plus
    script.livingroom_amp_vol_down:
        friendly_name: "Vol down"
        icon: mdi:volume-minus
    script.livingroom_amp_bass_boost_eq:
        friendly_name: "Bass boost EQ"
        icon: mdi:speaker-wireless

    #Hidden items
    switch.wakeup_the_broadlink:
        hidden: true
    switch.ac_temp_up:
        icon: mdi:thermometer-lines
        assumed_state: false
        hidden: true
    switch.ac_temp_down:
        icon: mdi:snowflake
        assumed_state: false
        hidden: true
    switch.ac_fan_speed:
        icon: mdi:fan
        assumed_state: false
        hidden: true
    switch.ac_mode:
        icon: mdi:settings-box
        assumed_state: false
        hidden: true
    switch.ac_timer:
        icon: mdi:av-timer
        assumed_state: false
        hidden: true
    switch.livingroom_amp_vol_up:
        icon: mdi:volume-plus
        assumed_state: false
        hidden: true
    switch.livingroom_amp_vol_down:
        icon: mdi:volume-minus
        assumed_state: false
        hidden: true
    switch.livingroom_amp_bass_boost_eq:
        icon: mdi:speaker-wireless
        assumed_state: false
        hidden: true
    script.ac_poweroff:
        hidden: true
    script.ac_poweron:
        hidden: true
    script.livingroom_amp_poweroff:
        hidden: true

switch:
  #Broadlink "RM mini 3" IR Transciever
  - platform: broadlink
    # type: rm_mini
    timeout: 15
    host: 192.168.1.12
    mac: 'xx:xx:xx:xx:xx:xx'
    switches:
      wakeup_the_broadlink:
        #Fire 0x00 as a dummy code. This will wake up the broadlink device if it hasn't been used in a six-ish or so hours.  Otherwise codes do not seem to fire properly when waking up the house???
        friendly_name: "Wakeup the Broadlink"
        command_on: '================'
        command_off: '================'
      ac_power:
        friendly_name: "AC Power"
        command_on: 'JgBoAAABJJQSNxETEhMRExITERMSExE4ERMSNxI3EhMRExI3EjgRExE4EhMRExITERMSExETEjcSExE4ETgROBE4ETgROBITEQAFZgABI0sRAAxAAAEjSxEADD8AASRKEgAMPwABI0sRAA0F'
        command_off: 'JgBoAAABJJQSNxETEhMRExITERMSExE4ERMSNxI3EhMRExI3EjgRExE4EhMRExITERMSExETEjcSExE4ETgROBE4ETgROBITEQAFZgABI0sRAAxAAAEjSxEADD8AASRKEgAMPwABI0sRAA0F'
      ac_temp_up:
        friendly_name: "AC Temp Up"
        command_on: 'JgBYAAABJpEUNRQRFBAUERQRExEUERM2ExEUNRQ1FBETERQ1FDUUERM2FBAUNRQRFBAUERQREzYTERQ1FBETNhM2EzYTNhMRFAAFZAABJUkTAAw9AAEmSBQADQU====='
      ac_temp_down:
        friendly_name: "AC Temp Down"
        command_on: 'JgBYAAABJpEUNRQRFBAUERQRExEUERM2ExEUNRQ1FBETERQ1FDUUERM2FBAUNRQRFBAUERQREzYTERQ1FBETNhM2EzYTNhMRFAAFZAABJUkTAAw9AAEmSBQADQU====='
      ac_fan_speed:
        #Cycles through three available fan speeds when pressed repeatedly
        friendly_name: "AC Fan Speed"
        command_on: 'JgBQAAABJZIUNRQRExEUERMRFBEUERM2ExEUNRQ1FBETERQ1FDUUERM2ExEUERQ1FDUUERMRFDUUERM2EzYTERQREzYTNhMRFAAFZAABJUkTAA0FAAAAAAAAAAA====='
      ac_mode:
        friendly_name: "AC Mode"
        command_on: 'JgCAAAABJpEUNhMRFBETERQRExEUERM2ExEUNRQ1FBETERQ1FDYTERQ1FDUUERM2EzYTERQREzYTERQREzYTEhMREzYTNhMSEwAFYwABJkkUAAw9AAElSRMADD4AASVJEwAMPgABJUkTAAw9AAEmSRMADD0AASZIFAAMPQABJkgUAA0FAAAAAAAAAAA====='
      ac_timer:
        #Timer goes up to 24 when pressed repeatedly
        friendly_name: "AC Timer"
        command_on: 'JgB4AAABJZEUNhMRFBETERQRExEUERM2ExEUNRQ1FBETEhM2EzYTERQ1FDUUNRQ1FDUUERMRFDUUERQRExEUERMRFDUUNRQREwAFZQABJUgUAAw8AAEmSRMADD0AASZJEwAMPQABJkgUAAw9AAElSRMADD4AASVIFAANBQ=========='

      livingroom_amp_power:
        friendly_name: "Livingroom Amp Power"
        command_on: 'JgCoAFASKBIWESkRFhEpEhUSFhEWERYRFhIVEigAA0tQEikRFhIoEhUSKREVEhUTFRIVEhUSFRMnAANMTxMoEhUSKBIVEygSFRIVEhUTFBMVEhUSKAADTE8TJxMVEigSFRIoExQTFRIVEhUSFRMVEigAA0tPEygSFRMoEhUSKREWERYSFRIWERYRFhEpAANLUBIoEhYRKREWEigSFhEWERYRFhIVEhYRKQANBQ=========='
        command_off: 'JgCoAFASKBIWESkRFhEpEhUSFhEWERYRFhIVEigAA0tQEikRFhIoEhUSKREVEhUTFRIVEhUSFRMnAANMTxMoEhUSKBIVEygSFRIVEhUTFBMVEhUSKAADTE8TJxMVEigSFRIoExQTFRIVEhUSFRMVEigAA0tPEygSFRMoEhUSKREWERYSFRIWERYRFhEpAANLUBIoEhYRKREWEigSFhEWERYRFhIVEhYRKQANBQ=========='
      livingroom_amp_vol_up:
        friendly_name: "Livingroom Amp Vol Up"
        command_on: 'JgCMAE8TFRIoEhUSFRMoEhUSFRIVExQTFRIVEigAA19PEhUTKBIVEhUSKBMUExUSFRIVEhUTFBMoAANeTxMVEigTFBMVEigSFRIVExQTFRIVEhUSKAADX08TFBMoEhQTFRMnExQTFRIUExQUFBMUEygAA19PEhUTJxMVEhUSKBIVExQTFRIVEhUTFBMnAA0FAAAAAAAAAAAAAAAA'
      livingroom_amp_vol_down:
        friendly_name: "Livingroom Amp Vol Down"
        command_on: 'JgCMAFASKBMoEhUSFRIoEhUTFBMVEhUSFRIVEygAA0tPEygSKBIVExUSKBIVEhUSFRMVEhUSFRIoAANMTxMoEigSFRIVEigTFRIVEhUSFRMUExUSKAADS1ASKBMnExUSFRIoEhUTFBMVEhUSFRIUFCgAA0tPEygSKBIVExUSKBIVEhUSFRMVEhUSFRIoAA0FAAAAAAAAAAAAAAAA'
      livingroom_amp_bass_boost_eq:
        friendly_name: "Livingroom Amp Bass Boost EQ"
        command_on: 'JgCqAE8TKBIVEigTJxMVEhUSKBIVExQTFRIVEigSFRMVEigAArBPEygSFRIoEigSFRMUEygSFRIVEhUTFRIoEhUSFRMnAAKwUBIoExQTKBIoEhUSFRMnExUSFRIVEhUTKBIVEhUSKAACsE8TKBIVEigTJxMVEhUSKBIVExQTFRIVEigSFRMVEigAArBPEygSFRIoEigSFRMVEigSFRIVEhUTFRIoEhUSFRMnAA0FAAAAAAAAAAAAAAAAAAA====='

script:
  #These scripts are here so that HASS dashboard will display a one-shot "activate" button for these 'dumbfire' IR blasts (instead of a displaying a toggle for a smartdevice, which would falsely imply a known state of on/off for each action)
  ac_temp_up:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_temp_up
  ac_temp_down:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_temp_down
  ac_fan_speed:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_fan_speed
  ac_mode:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_mode
  ac_timer:
    sequence:
      - service: switch.turn_on
        entity_id: switch.ac_timer
  livingroom_amp_vol_up:
    sequence:
      - service: switch.turn_on
        entity_id: switch.livingroom_amp_vol_up
  livingroom_amp_vol_down:
    sequence:
      - service: switch.turn_on
        entity_id: switch.livingroom_amp_vol_down
  livingroom_amp_bass_boost_eq:
    sequence:
      - service: switch.turn_on
        entity_id: switch.livingroom_amp_bass_boost_eq

  #These scripts are kludges for IR blasters since they will fire twice if "off" switch is triggered twice.
  #This is a problem if the on/off signal are the same IR signal
  ac_poweroff:
    sequence:
        #activate turn_off only if switch.ac_power is 'on'
      - condition: template
        value_template: >
          {% if is_state('switch.ac_power', 'on') %}
            true
          {% elif is_state('switch.ac_power', 'off') %}
            false
          {% else %}
            false
          {% endif %}
      - service: switch.turn_off
        entity_id: switch.ac_power
  ac_poweron:
    sequence:
        #activate turn_off only if switch.ac_power is 'on'
      - condition: template
        value_template: >
          {% if is_state('switch.ac_power', 'off') %}
            true
          {% elif is_state('switch.ac_power', 'on') %}
            false
          {% else %}
            false
          {% endif %}
      - service: switch.turn_on
        entity_id: switch.ac_power
      - service: switch.turn_on
        entity_id: switch.ac_mode
  livingroom_amp_poweroff:
    sequence:
        #activate turn_off only if switch.livingroom_amp_power is 'on'
      - condition: template
        value_template: >
          {% if is_state('switch.livingroom_amp_power', 'on') %}
            true
          {% elif is_state('switch.livingroom_amp_power', 'off') %}
            false
          {% else %}
            false
          {% endif %}
      - service: switch.turn_off
        entity_id: switch.livingroom_amp_power

group:
  ac_remote:
    name: "Air Conditioner"
    control: hidden
    entities:
     - switch.ac_power
     - script.ac_temp_up
     - script.ac_temp_down
     - script.ac_fan_speed
     - script.ac_mode
     - script.ac_timer

  #Air conditioner tab
  hvac_view:
    view: yes
    name: AC
    #name: T
    entities:
      - sensor.indoor_temp
      - sensor.pws_temp_f
      - sensor.pws_weather
      - group.thermostat
      - group.ac_remote
      - group.sensor_node_1_card
      - group.sensor_node_2_card

  #Audio tab
  audio_view:
    view: yes
    name: AUD
    #name: Hz
    entities:
      - group.residence_radio
      - group.livingroom_amp_remote
      - switch.kitchen_speaker_amp
      - switch.bathroom_speaker_amp
      - group.chromecast_controls
1 Like

Yes, it was the assumed_state: false that sets the display to the toggle. (thanks, @Bobby_Nobble)

But…

I ran into a situation (that I created another thread about) in which I set all the broadlink entities to assumed_state: false and all but one of them displayed the toggle afterwards. I’m not sure where the assumed_state: true was being set but it was listed in the entity attributes as true. I could force it to false there and the display changed to a toggle but as soon as I restarted HA it went right back to the two buttons again.

Someone suggested I put the assumed_state: false in the customize_glob: section for the desired switches and so far that has seemed to make it stick.

Still not sure why/where it was being set to true when none of the others were, tho.

1 Like

Hi Wheezy,

really like your script and would like to learn more on creating group tab etc,
If you dont mind could you share the complete code? I just need to learn how to do some stuff… very nubie, however I manage to change to button thanks to your detail code.

TIA…

Hey, I’m glad it helped. I think you’re wondering how to create new tabs for your main HASS dashboard? Those tabs are called “Views”. “Groups” are basically cards on the dashboard. The “group:” area in your configuration.yaml file defines both groups and views.

I remember this being a difficult thing to learn when I was just starting too, since the terminology is so confusing. BRUH Automation’s YouTube channel helped me a lot. I recommend checking out Ben’s video here to get your started https://www.youtube.com/watch?v=EsBtyF5tZQ4&feature=youtu.be&t=8m11s

I’ll also copy-paste part the “group:” part of my configuration.yaml file below along with some images. Please let me know if that doesn’t answer the question though. (I’ve added some devices since I last posted my code, but the above code is also still implemented in my setup).


#####################################################################
#                           GROUPS & VIEWS                          #
#####################################################################
#Views are pages, selectable at the top of HASS dashboard.  Groups are 
#  "display cards" that put many switches into the same box in a page 
#  of HASS dashboard.

####GROUPS
#group: !include groups.yaml
group:

  zones:
    name: Zones
    entities:
      - sensor.template_last_motion
      - binary_sensor.floorplan

  chromecast_controls:
    name: Chromecast Controls
    entities:
      - media_player.all_home_speakers
      - media_player.livingroom_speakers
      - media_player.bedroom_speakers
      - media_player.kitchen_speakers
      - media_player.bathroom_speakers

  livingroom_lights:
    name: Livingroom
    entities:
      - light.livingroom_1
      - light.livingroom_2
      - light.livingroom_3
      - light.livingroom_4
  kitchen_lights:
    name: Kitchen
    entities:
      - light.kitchen_1
      - light.kitchen_2
  kitchen_table_lights:
    name: Kitchen Table
    entities:
      - light.kitchen_table_1
      - light.kitchen_table_2
  bedroom_lights:
    name: Bedroom
    entities:
      - light.bedroom_1
      - light.bedroom_2
  bathroom_lights:
    name: Bathroom
    entities:
      - light.bathroom_1
      - light.bathroom_2
      - light.bathroom_3
      - light.bathroom_4
  color_temperature:
    name: Brightness / Temperature
    entities:
      - group.livingroom_lights
      - group.kitchen_lights
      - group.kitchen_table_lights
      - light.hallway
      - group.bathroom_lights
      - group.bedroom_lights
      
  tradfri_lights:
    name: Lights
    entities:
      - light.livingroom
      - light.kitchen
      - light.bedroom
      - light.bathroom
  
####VIEWS
  #Default tab: If this is enabled, ONLY things defined here will show up in HASS main view!!!
  default_view:
    view: yes
    entities:
      #Dashboard gauges
      - device_tracker.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      - sensor.indoor_temp
      #- sensor.pws_temp_f
      - sensor.dark_sky_temperature
      - sensor.pollen_level
      - sensor.pws_weather
      
      #Things
      - script.eggs_and_bakey
      - script.bedtime
      - automation.kodi_movie_mode_while_playing_media
      - automation.kodi_house_mode_when_media_stops
      - automation.powerup_on_arrival
      - automation.powerdown_on_departure
      - automation.porch_lit_on_arrival
      - media_player.tv_pc
      - media_player.ps4
      - switch.scented_wax_warmer
      #- switch.wake_tv_pc
      - group.alarm

  #Audio tab
  audio_view:
    view: yes
    name: AUD
    #name: Hz
    entities:
      - group.residence_radio
      - group.livingroom_amp_remote
      - group.bedroom_amp_remote
      - switch.kitchen_speaker_amp
      - switch.bathroom_speaker_amp
      - group.chromecast_controls
      - group.music_spotify
      # Spotify media player only displays artwork of currently playing songs.
      #   It leaves the artwork up after Spotify is off.  Also, no controls work (play/pause/stop/forward/back).
      #   Chromecast Audio works for displaying the same artwork and stopping play.
      # - media_player.spotify
      - switch.sound_machine
      
  #Air conditioner tab
  hvac_view:
    view: yes
    name: AC
    #name: T
    entities:
      - sensor.livingroom_temp
      - sensor.bedroom_temp
      #- sensor.pws_temp_f
      - sensor.dark_sky_temperature
      - sensor.pws_weather
      - group.thermostat
      - group.ac_remote
      - group.heater_remote
      - group.sensor_node_1_card
      - group.sensor_node_2_card

  lights_view:
    view: yes
    name: LUX
    #name: hν
    entities:
      - switch.fluxer
      - switch.porch_light
      - group.color_temperature
      - group.tradfri_lights

Edit: Code error above … (the post is too old to edit at this point, but one IR command should be the following instead)

ac_temp_down:
        friendly_name: "AC Temp Down"
        command_on: 'JgBQAAABI5QSNxITERQRExITERMSExE4ERMSNxI3EhMRExI3EjcSExETEjcSExE4EhMRExITETgROBETEjcSExE4ETgSNxETEgAFZgABI0sRAA0FAAAAAAAAAAA====='

Thank you sooo much… you have been a great help…

1 Like

Hi Wheezy!

First of all, I want to thank you for your help. The second is that I have a problem with the power switch, once it is in the ‘on’ state and restart home assistant, it returns to false status. I have tried many things but nothing. Does anything have to do with the recorder? I do not understand the scripts either ac_poweroff and ac_poweron.

I do not give with the key… thank you in advance!

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.