I'm an idiot.. please help. trying to split my configuration.yaml

hi all…

ok… i’m new to Homeassistant/hassio and with a little help on here managed to get my rm pro+ to show up with 2 rf sockets as switches.

on doing this it was suggested that i split the rf codes to tidy up my configuration.yaml and make it easier in future to automate as I could just call the switch as a switch and not enter the rf code all the time. ( i really hope that makes sense to someone out there… )

here is what I tried…

in my configuration.yaml

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
broadlink: !include broadlink.yaml

in a new file located in the same folder broadlink.yaml

# Broadlink RM pro
switch:
  - platform: broadlink
    host: IP address removed
    mac: 'mac address removed'
    switches:
      tall_lamp:
        friendly_name: "Tall Lamp"
        command_on: 'sgCSAQtMJA4LJgwmJA4LJyMODCYkDiQOJA0lDSQOCyckDQwmCyYMJiUNDCYLJwsnIw4MJgsnC0wkDQwmDCYkDgsmJQ0MJiQNJQ0lDSUNJA0MJiUNCycLJwsmJQ0MJgsnCyYkDgwmCycLSyUNDCYMJiQNDCYkDgsnJA4kDSUNJA4kDQwmJQ0MJgsnCyYlDQsnCyYMJiQODCYMJgtMJA4LJgsnJA4LJiUNDCYkDiMOJA4kDiQOCyYlDQsnCyYMJiQODCYLJwsmJA4MJQwnYusgERAiECIhERAiIBIQIiASIBIgEiASIBEQIiASECIQIhAiIBIPIw8jDyIhERAiECJj6iASECIQIiASDyMgEg8iIBIgEiASIREhERAiIBIPIw8jDyMgERAiECIQIiASECIQImPqIBIPIw8jIBEQIiERECIgEiASIBIgEiASDyMgERAiECIQIiASECIPIxAiIBIPIw8jYusgEg8iECIgEhAiIBIQIiASIBIgEiASIBEQIiERECIPIxAiIBIPIhAiECMgERAiEAAF3AAAAAAAAA=='
        command_off: 'sgCSAQxMIw4MJgsnJA0lDSQOJA4kDQwmDCYLJyQNDCYlDQsmJQ0MJgwmCyckDQwmJA4LJgwmDEwjDgsnCyYlDSUNJA4kDiQOCyYMJgsnJA0MJiQOCyYlDQwmDCYLJyQNDCYkDgsmDCcLSyUNCycLJyQNJQ0kDiQOJA0MJgwmCyckDQwmJA4LJyQNDCYMJgwmJA0MJiQOCycLJwtLJQ0LJwsmJQ0lDSUNJA4kDQwmDCYLJyQNDCYlDQsnJA4LJgwmCyYlDQwmJA4LJwsnYusgERAiECIgEiASIBIgEiASDyIQIw8iIBIQIiASECIgEg8jDyIQIyARECMgERAiECJj6iASECIPIyASIBEhEiARIRIPIhAiECIgEhAiIBIPIyARECMPIhAiIREQIiASDyMQImPqIBIPIw8jIBIgEiARIREgEhAiDyMQIiASDyMgERAiIBIQIhAiDyMgEhAiIBIPIw8jYusgEg8iECMgESASIBIgEiASDyMPIw8jIBEQIiASECIgEhAiDyMPIyASDyIhERAiEAAF3AAAAAAAAA=='
      corner_lamp:
        friendly_name: "Corner Lamp"
        command_on: 'sgCTAQtMJA0MJgwmJA4kDiQNJQ0LJyQNJQ0MJiUNCyckDSUNDCYkDgsmJQ0kDgwlDCYMJgsnDEskDgsmDCYkDiQOJA0lDQwmJA4kDQwmJQ0LJyQOIw4MJiQNDCYlDSUNCyYMJgwmCycLTCQOCyYMJiQOJA0lDSQOCyckDSUNCyckDgsnJA0kDgsnJA0MJiQOJA4LJwsmCycLJwtMJA4LJgsnJA4kDSUNJA4LJyQOIw4MJiQOCyYlDSQOCyckDQwmJA4kDQwmDCYMJgsnYusgEg8jDyMgESASIBIgEhAiIBIgEg8jIBIPIyARIBIQIiASECIgESESDyIQIw8iECNi6iASECIPIyASIBIgESERECIgEiASECIgEg8jIBIgEg8jIBIPIiERIREQIg8jDyMPI2LrIBIPIhAjIBEhESERIBIQIiASIBIPIyASDyMgEiARECMgERAiIBIgEhAiDyMPIw8jYusgERAiECIhESERIBIgEg8jIBIWChIPIiERECIgEiASECIgEhAiIBIgEg8jDyIQIw8ABdwAAAAAAA=='
        command_off: 'sgCSAQxLJA0MJgwmJA4kDiQOIw4kDgwmCyYMJiUNCyckDQwmJA4LJgwmDCYkDgsnCyYMJgwmDEskDQwmDCYkDiQNJQ0lDSQOCycLJwsmJA4LJiUNDCYkDgsnCyYMJiQODCYLJgwmDCYLTCQNDCYMJiQOJA0lDSUNJA4LJwsmDCYkDgsmJQ0MJiQOCycLJgsnJA4LJgwmDCYLJwtMJA0MJgwmJA4kDiMOJA4kDgsmDCYMJiQOCyYlDQwmJA4LJgwmCyckDQwmDCYMJgsnYuohERAjDyIgEiASIBIgEiASECIPIhAjIBEQIiERECIgEg8jECIPIiASECIQIhAiECJj6iASDyMQIiASIBEhEiARIREQIhAiECIgEhAhIRIPIiERECIQIg8jIBIPIw8iECMPImPqIBIQIhAiIBIgEiASIBIgERAiECIQIiASECIgEg8jIBEQIhAjDyMgERAiECIQIhAiY+ogEg8jECIgESERIREgEiASECIPIw8jIBEQIyARECIgEhAiDyMPIyARECIQIhAjDwAF3AAAAAAAAA=='

when I check my configuration.yaml with the checker this is what i get…

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

Configuration invalidCHECK CONFIG

Component not found: broadlink"

what have i done wrong? or is it easier to answer what I done right? (if anything) …
and how can i correct it to get it working?

i’m trying to make these lamps turn on at sunset, its my first configuration/automation so im probably going to ask a lot of questions… hope you don’t mind…

Robin

Change the line that starts ‘broadlink’ in configuration.yaml to

switch: !include broadlink.yaml

And remove the whole line switch: from broadlink.yaml

1 Like

Thanks…

If I wanted to split this further into broadlinkir.yaml and broadlinkrf.yaml would I enter

switch: !include broadlinkir.yaml
switch: !include broadlinkrf.yaml

Or is there a better way?

Suppose I could split it in the broadlink.yaml file with comments if needed…

This will not work.

Yep.

Specifically:

  • !include_dir_list will return the content of a directory as a list with each file content being an entry in the list.
  • !include_dir_named will return the content of a directory as a dictionary which maps filename => content of file.
  • !include_dir_merge_list will return the content of a directory as a list by merging all files (which should contain a list) into 1 big list.
  • !include_dir_merge_named will return the content of a directory as a dictionary by loading each file and merging it into 1 big dictionary.

@flamingm0e 's suggestion is the best way, but you can also do

switch 1: !include broadlinkir.yaml
switch 2: !include broadlinkrf.yaml

In your configuration.yaml if that’s easier for you.

thank you,

if @flamingm0e’s suggestion is the best way then that is my preferred method…

i read the page though to be honest i didn’t make much sense to me (i’m sorry though i am an idiot when it comes to this… ) i think once i create my first automation and script then i may understand things better and have a better platform to learn more… .

from what i read the option that would i would use is the !include_dir_list to hold a list of ir or rf codes paired to a friendly name.

which I think is what i am looking to do…

is that right?

Depends :see_no_evil:

switch: < if the include is here it is one of the *list* ones
  - platform: broadlink
    host: xxx.xxx.xxx.xxx 
    mac: xx:xx:xx:xx:xx
    switches:  < if it is here it is one of the *name* ones

And which of the list/name include types you use depends on how you split the content.

Can you paste the whole section of configuration.yaml you’re trying to split out?

Thanks,

The snippit above is currently the whole section, though I plan to add a lot more remotes both in rf and ir.

I think I’d put the broadlink details in the configuration.yaml and use the “name” one to create a list of codes in another file to choose from…

At the moment my hassio is down as I’ve tried to upgrade and I think it’s gone wrong but I’ll give it a go In The morning and get back…

Thank you again

1 Like

Hi everyone

I am trying to split my configuration file as well here. I have read the various postings but am struggling
I have added the various files and all is ok
can someone plea se help me with the syntax

This is my current configuration (part) and all works -
mqtt:
broker: localhost
protocol: 3.1
client_id: hass-1
username: pi
password: raspberry123

switch 1:
platform: mqtt
name: “Hallway Motion”
state_topic: “smartthings/HallwayMotion/switch”
command_topic: “smartthings/HallwayMotion/switch”
payload_on: “on”
payload_off: “off”
retain: true

switch 2:
platform: mqtt
name: “Hallway Lights”
state_topic: “smartthings/HallLights/switch”
command_topic: “smartthings/HallLights/switch”
payload_on: “on”
payload_off: “off”
retain: true

group: !include groups.yaml
automation: !include automations.yaml
zone: !include zone.yaml
sensor: !include sensor.yaml
switch: !include switch.yaml
device_tracker: !include device_tracker.yaml
script: !include scripts.yaml

What do I have to change to put these 2 switches into switch.yaml please?

Remove them from the configuration.yaml and add them to switch.yaml like this:

- platform: mqtt
  name: “Hallway Motion”
  state_topic: “smartthings/HallwayMotion/switch”
  command_topic: “smartthings/HallwayMotion/switch”
  payload_on: “on”
  payload_off: “off”
  retain: true

- platform: mqtt
  name: “Hallway Lights”
  state_topic: “smartthings/HallLights/switch”
  command_topic: “smartthings/HallLights/switch”
  payload_on: “on”
  payload_off: “off”
  retain: true

Thanks all working well now?
I am trying to reflect a SmartThings Motion Sensor now in HA via MQTT.
I have got the icon on the Overview but it doesnt update.
Am I doing something wrong?

Here is a snippet from the mosquitto_log
smartthings/HallwayMotion1/motion active
smartthings/HallwayMotion1/motion inactive

binary_sensor:

  • platform: mqtt
    name: “Hallway”
    state_topic: “smartthings/HallwayMotion1/motion”
    payload_on: “active”
    payload_off: “inactive”
    qos: 0
    device_class: motion

Can someone point out what I am doing wrong please?

Back to basics, you have:

  • got the mqtt component setup in homeassistant and linked to your broker?
  • restarted homeassistant since adding the sensor and made sure there has been an update on that topic since the restart?

By MQTT Component you mean this in configuration.yaml
mqtt:
broker: localhost
client_id: smartthings
username: –
password: ---------------

?
I monitoring the mosquitto_log and seems everything is working there…

Yeah that was the one.

Do you have any other binary sensors in your setup?

No just the one to test initially
Now it seems that HA is not reflecting the changes published on the mqtt bridge.
I will be testing the HA - MQTT connection now