Problem with using broadlink as a switch

Hello, I have Home assistant version 2022.2.3. I am using Broadlink RM pro to control RF fan and some broadlink mini to control TV and air conditioner. Since a few days when I try to reset my home assistant to update a version I get an error message when I press “check configuration”:

Invalid config for [switch.broadlink]: [fan_speed_1] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->fan_speed_1. (See ?, line ?).
Invalid config for [switch.broadlink]: [fan_speed_2] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->fan_speed_2. (See ?, line ?).
Invalid config for [switch.broadlink]: [fan_speed_3] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->fan_speed_3. (See ?, line ?).
Invalid config for [switch.broadlink]: [fan_speed_4] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->fan_speed_4. (See ?, line ?).
Invalid config for [switch.broadlink]: [fan_speed_5] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->fan_speed_5. (See ?, line ?).
Invalid config for [switch.broadlink]: [fan_speed_6] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->fan_speed_6. (See ?, line ?).
Invalid config for [switch.broadlink]: [direction_1] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->direction_1. (See ?, line ?).
Invalid config for [switch.broadlink]: [direction_2] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->direction_2. (See ?, line ?).
Invalid config for [switch.broadlink]: [light_1] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->light_1. (See ?, line ?).
Invalid config for [switch.broadlink]: [light_2] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->light_2. (See ?, line ?).
Invalid config for [switch.broadlink]: [turn_off_fan] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->turn_off_fan. (See ?, line ?).
Invalid config for [switch.broadlink]: [power_on] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->power_on. (See ?, line ?).
Invalid config for [switch.broadlink]: [roomba] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->roomba. (See ?, line ?).
Invalid config for [switch.broadlink]: [roomba] is an invalid option for [switch.broadlink]. Check: switch.broadlink->switches->0->roomba. (See ?, line ?).

I didn’t have this problem before. It’s the code:

switch:

  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      fan_speed_1:
        friendly_name: "Set Fan speed 1"
        command_on: "..."
        
 - platform: broadlink
    mac: '...'
    host: ...
    switches:
      fan_speed_2:
        friendly_name: "Set Fan speed 2"
        command_on: "...""
    
 - platform: broadlink
    mac: '...'
    host: ...
    switches:
      fan_speed_3:
        friendly_name: "Set Fan speed 3"
        command_on: "..."
        
  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      fan_speed_4:
        friendly_name: "Set Fan speed 4"
        command_on: "...""
        
  - platform: broadlink
    mac: '....'
    host: ....
    switches:
      fan_speed_5:
        friendly_name: "Set Fan speed 5"
        command_on: "..."
        
  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      fan_speed_6:
        friendly_name: "Set Fan speed 6"
        command_on: "...."  
    
  - platform: broadlink
    mac: '....'
    host: ...
    switches:
      direction_1:
        friendly_name: "Set Direction 1"
        command_on: "...."
 
  - platform: broadlink
    mac: '...'
    host: ....
    switches:
      direction_2:
        friendly_name: "Set Direction 2"
        command_on: "...."    
        
        
  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      light_1:
        friendly_name: "Set Light 1"
        command_on: "..."
        
  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      light_2:
        friendly_name: "Set Light 2"
        command_on: "..."
        
  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      turn_off_fan:
        friendly_name: "Turn off fan"
        command_on: "..."
   
  - platform: broadlink
    mac: '...'
    host: ....
    switches:
      power_on:
        friendly_name: "Turn on and off TV"
        command_on: "..."
        command_off: "..."

  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      roomba:
        friendly_name: "Roomba On/Off"
        command_on: "..."
        command_off: "..."

  - platform: broadlink
    mac: '...'
    host: ...
    switches:
      roomba:
        friendly_name: "Roomba Dock"
        command_on: "..."
       

What is the problem? Is something changed in this version?

Didn’t you read the the release notes before updating?
It’s in the breaking changes.

Thank you, I didn’t notice that. So how can I configure the broadlink now? I didn’t find an option in the UI.

I am using Dwains Dashboard as default and not lovelace

I did read the breaking changes and removed all my yaml entries for my broadlink switches which removed all the error codes when I “check configeration” but even though the broadlink devices are still showing in my integrations none of the switches are available?

having the same issue!

Since I just struggled with this same issue:

And someone else here:

tl;dr is change your YAML syntax to reflect the following (note the “- name:” as well as no “friendly_name:”)

switch:
  - platform: broadlink
    mac: MAC_ADDRESS
    switches:
      - name: Philips TV
        command_on: JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=
        command_off: JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=
1 Like

Thank you very much!!

Hi Ben

Thanks for that but could you please let me know the following as I tried your way and it’s not working for me.

1- Is that in your configuration.yaml or switch.yaml file?
2- Do you still need add the command name as in your example it would have been philips_tv_on
3- Did you mean to leave all the " " of bothe the name and the commands.
4- Lastly, where did you find this solution, could you please post the link?

Sorry if these sound like nooby questions but that’s because I am.

  1. If you have an include for a switch.yaml in your configuration.yaml, then you need it in your switch.yaml :grimacing:.

In any case, put it under your “switch” hierarchy.

  1. Yes, you need to provide a name, so the entity has a name. Note: not a friendly_name.

  2. In my config, I have only the commands within single quotes. The name has no quotes. The example provided by the docs I linked do not have any quotes. That Philips example ALSO works for me. So to my knowledge, it makes no difference for these kinds of commands, whether you put quotes around it or not.

  3. Check my last post and click on the word “following”. That links to
    Broadlink - Home Assistant

Thanks again Ben and it’s much appreciated but i still can’t get it to work as the config check passes but I cannot see the switch in Dev Tools.
Would you be so kind as to cut and paste your whole switch entry please


switch:
  - platform: broadlink
    mac: 'AA:AA:AA:AA:AA:AA'
    switches:

      - name: Philips TV
        command_on: JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=
        command_off: JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=
      - name: blue_vase_power
        command_on: 'JgBQAAABJ5MTEhETEhMTEhEUERQQFRAUETkSNxM3EjgSNxE5EjgSNxEUEhMSExAVERMTEhA5EhQQORI4EzYRORM3EDkQFRI3EQAFHAABJ0oRAA0FAAAAAAAAAAA='

Please remember, that you will only have the top line
switch:

ONCE in your whole configuration.yaml…

I showed you mine, now show me yours. Maybe we can figure it out together :wink:.

Switches pop up in my dev tools just fine.

1 Like

Haha, showing mine but bit embarresed as too short, in life as in Home Assistant!

Tried this…

switch:

  • platform: broadlink
    mac: ‘a0:43:b0:53:f6:76’
    switches:
    -name: “LG TV Power”
    command_on: “JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==”
    command_off: “JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==”

And
switch:

  • platform: broadlink
    mac: ‘a0:43:b0:53:f6:76’
    switches:
    -name: LG TV Power
    command_on: JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==
    command_off: JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==

neither work

Try posting with the original formatting, because otherwise it’s really difficult for anyone to help :stuck_out_tongue_winking_eye:

But right off the bat… Maybe the lack of a space between the dash and the word “name”?

Try just copying my text above as is, starting at “switches:” and putting that instead of your lines. See what happens.

This is original formatting

switch:
  - platform: broadlink
    mac: 'a0:43:b0:53:f6:76'
    switches:
  - name: "Living Room TV Power"
      command_on: "JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA=="
      command_off: "JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA=="

**AND THIS** 

switch:
  - platform: broadlink
    mac: 'a0:43:b0:53:f6:76'
    switches:
  - name: Living Room TV Power
      command_on: JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==
      command_off: JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==

On Check Config I get the following

Configuration validation

Validate your configuration if you recently made some changes to your configuration and want to make sure that it is all valid.

Configuration invalidCHECK CONFIGURATION

Invalid config for [switch]: required key not provided @ data[‘platform’]. Got None. (See ?, line ?).TextPreformatted text

You didn’t try my config lines, did you? :wink:
YAML is finicky with spaces.

Your config
image

My config
image

Move your “- name” lines 4 spaces to the right and the “command” lines 2 spaces to the right.

Driving me mad as looks so simple but please tell me this is exact same as yours?
But I’m still getting the same error as above!!

switch:
  - platform: broadlink
    mac: 'a0:43:b0:53:f6:76'
    switches:
    
      - name: Living Room TV Power
        command_on: JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==
        command_off: JgBYAAABIZMSExETEjcSExISEhMRExITEjcSNxEUETgSNxI3EjcSNxISEhMSEhI3EhMSExETERQROBI3EjcSEhI3EjcSNxI4EgAFEgABJEsSAAw0AAEkShIADQUAAAAAAAAAAAAAAAAAAA==

It’s impossible to get the exact same error as above with that configuration. You most likely have a mistake below what you posted.

I think the problem is one of the things Ben pointed out above but I’m not sure which “switch” reference i should take out the one in my configuration.yaml as below which points to a directory of switches which has the entry as above. I hope that makes sense.

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
switch: !include_dir_list switches/

Ben, if you’re there and not completely fed up of me, please help! I’ve now # out the switch: !include_dir_list switches/ and put your code with my mac address directly into the configuration.yaml and it is passing the Config Check but I still cannot see the switches when trying to use in Lovelace or in Dev Tools. Do I need to do anything else to mak them visible? It is now also passing with my switches but I am using yours just to try and make it easier to debug as it is working for you.

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# switch: !include_dir_list switches/


switch:
  - platform: broadlink
    mac: 'a0:43:b0:53:f6:76'
    switches:

      - name: Philips TV
        command_on: JgAcAB0dHB44HhweGx4cHR06HB0cHhwdHB8bHhwADQUAAAAAAAAAAAAAAAA=
        command_off: JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA=
      - name: blue_vase_power
        command_on: 'JgBQAAABJ5MTEhETEhMTEhEUERQQFRAUETkSNxM3EjgSNxE5EjgSNxEUEhMSExAVERMTEhA5EhQQORI4EzYRORM3EDkQFRI3EQAFHAABJ0oRAA0FAAAAAAAAAAA='

is that the entire file or just a snippit? Also, what is the error that you’re currently getting. Please post it all in 1 post.