Problem with using broadlink as a switch

Hi Petro

Now I am not getting any error but I cannot see the Philps Tv on/off switches when I try and add buttons in Lovelace card. This is my full configuration.yaml file


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg


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

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='


# Broadlink
remote:
  - platform: broadlink
    host: 192.168.0.107
    mac: a0:43:b0:54:85:e2
    name: remote.kitchen_rm4_pro
  - platform: broadlink
    host: 192.168.0.101
    mac: a0:43:b0:31:cf:06
    name: remote.conservatory_rm4_pro
  - platform: broadlink
    host: 192.168.0.108
    mac: a0:43:b0:55:16:8f
    name: remote.sirus_rm4_pro
  - platform: broadlink
    host: 192.168.0.103
    mac: a0:43:b0:55:15:9e
    name: remote.poonam_rm4_pro
  - platform: broadlink
    host: 192.168.0.102
    mac: a0:43:b0:53:f6:76
    name: remote.pinkey_rm4_pro
  - platform: broadlink
    host: 192.168.0.105
    mac: a0:43:b0:54:9d:53
    name: remote.media_cabinet_rm4_mini
  - platform: broadlink
    host: 192.168.0.106
    mac: a0:43:b0:54:c0:28
    name: remote.living_room_rm4_mini
smartir:
climate:
  - platform: smartir
    name: Pinkey Heater
    unique_id: pinkey_heater
    device_code: 1101
    controller_data: remote.pinkey_rm4_pro_remote
    temperature_sensor: sensor.pinkey_rm4_pro_temperature
    humidity_sensor: sensor.pinkey_rm4_pro_humidity
  - platform: smartir
    name: Sirus Heater
    unique_id: sirus_heater
    device_code: 1101
    controller_data: remote.sirus_rm4_pro_remote
    temperature_sensor: sensor.sirus_rm4_pro_temperature
    humidity_sensor: sensor.sirus_rm4_pro_humidity
  - platform: smartir
    name: Poonam Heater
    unique_id: poonam_heater
    device_code: 1101
    controller_data: remote.poonam_rm4_pro_remote
    temperature_sensor: sensor.poonam_rm4_pro_temperature
    humidity_sensor: sensor.poonam_rm4_pro_humidity
  - platform: smartir
    name: Conservatory Heater
    unique_id: conservatory_heater
    device_code: 1101
    controller_data: remote.conservatory_rm4_pro_remote
    temperature_sensor: sensor.conservatory_rm4_pro_temperature
    humidity_sensor: sensor.conservatory_rm4_pro_humidity
  - platform: smartir
    name: Kitchen Heater
    unique_id: kitchen_heater
    device_code: 1101
    controller_data: remote.kitchen_rm4_pro_remote
    temperature_sensor: sensor.kitchen_rm4_pro_temperature
    humidity_sensor: sensor.kitchen_rm4_pro_humidity
  - platform: smartir
    name: Media Cabinet
    unique_id: media_cabinet
    device_code: 1101
    controller_data: remote.media_cabinet_rm4_mini_remote
    temperature_sensor: sensor.media_cabinet_rm4_mini_temperature
    humidity_sensor: sensor.media_cabinet_rm4_mini_humidity
  - platform: smartir
    name: Living Room Heater
    unique_id: living_room_heater
    device_code: 1101
    controller_data: remote.living_room_rm4_pro_remote
    temperature_sensor: sensor.living_room_rm4_pro_temperature
    humidity_sensor: sensor.living_room_rm4_pro_humidity

# Cloud
cloud:
  alexa:
    filter:
      include_domains:
        - light
      include_entities:
        - script.night
        - group.basement_lights
        - group.kitchen_lights
        - group.bar_lights
      exclude_domains:
        - automation
        - group
        - script
        - sensor
        - media_player
        - switch
        - camera
        - media_player
      exclude_entities:
        - switch.basementmaster_switch
    entity_config:
      script.night:
        description: A script to enable night mode

logger:
  default: critical
  logs:
    # log level for HA core
    homeassistant.core: fatal

    # log level for MQTT integration
    homeassistant.components.mqtt: warning

    # log level for all python scripts
    homeassistant.components.python_script: warning

    # individual log level for this python script
    homeassistant.components.python_script.my_new_script.py: debug

    # log level for SmartThings lights
    homeassistant.components.smartthings.light: info

    # log level for a custom component
    custom_components.my_integration: debug

    # log level for the `aiohttp` Python package
    aiohttp: error

    # log level for both 'glances_api' and 'glances' integration
    homeassistant.components.glances: fatal
    glances_api: fatal

Search your entities for Philips TV via the entities list. If it’s not there, you should have errors in your logs.

Thanks Petro, restarted and now it’s appeared but If I want to put this back in a seperate file and have this line in my configuration.yaml switch: !include_dir_list switches/, do I then put the following in my switch.yaml file, do I put switch: in there also?

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='

No the switch: is not included inside the file

Sorry Petro but it’s still not working if I do that!

If I have all all lines in configuration.yaml it works fine but I have many switches and it will make that file too long so I want to put in seperate file in a folder named switches

Please see below, is this what you meant?

In configuaration.yaml file I have only this line referring to switch
switch: !include_dir_list switches/

And in a seperate file named tvswitch.yaml in my switches folder I have the following, leaving out the first line being switch: as you suggested

- 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='

I am getting the following error when Checking Configuration

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

Your spacing is off again.
After your first line.

“mac” should be right below “platform”.

Align the rest as well, as you had it before.

Morning Ben,
That happened when I cut and pasted but in my actually tvswitch.yaml they are in line, unfortunately!
Do you know if they have changed the way you call up a dseperate file from your configuration.yaml using this?
!include_dir_list

Hi gs,
I don’t use the dir list includes, but a quick read of the docs show

"It is important to note that each file must contain only one entry when using !include_dir_list"

And the example lists an automation without the leading dash. That could be your problem.

alias: "Automation 1"
trigger:
  platform: state
  entity_id: device_tracker.iphone
  to: "home"
action:
  service: light.turn_on
  target:
    entity_id: light.entryway

I think it’s different when using automation as I have been using it with a list of different switches before the update without a problem. For now I think I’m just going to have to have a very long configuration file and call it a day on tis problem before I drive you and Petro insane!

Thank you Ben and Petro for all your help in this, it’s been much appreciated!

you should use

switch: !include_dir_merge_list switches/

with this in your file.

- 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='

The file should reside in a folder called switches that’s located in your config directory. The file name does not matter.

Thanks Petro, we are getting closer as the merge lists is what I needed and now Check Configuration is ok.
BUT when I retstart, I cannot find Philips TV in the entities again. I’ll put exactly what I have.

In configuration.yaml I have
switch: !include_dir_merge_list switches/

In a file named tvswitches.yaml in the config\switches folder I have

- 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='

make sure your spacing is correct, you should have an error in your logs if it’s not read correctly. The error may not show up with check config. Always consult your home-assistant.log file. On the surface, I can see your spacing is off for platform & mac, but that could be a copy/paste issue.

Sorry Ben pointed out the spaing but in my file, platform, mac, and switches are all in same line.
By Log File, d you mean the one in Supervisor\System tab, if you do then no errors showing. I just can’t understand it!

No, inside your config folder there will be a home_assistant.log file and you can view it. There’s not much to understand. Either your config is correct and the device shows up or it’s not correct and it doesn’t. You have to search for the entity properly to know it showed up. If you don’t know how to do that, you’re going to have a bad time. If you don’t know how to look for the config errors, you’re going to have a bad time. You need to learn those basics.

Thanks Benjamin, you’re a star!
Your posts helped me sort out my broadlink switches and I’ve managed to update with everything back up and running again.