#Custom component not including automations.yaml

1 messages · Page 1 of 1 (latest)

wide shell
#

Is it fair to expect the automations.yaml in my custom component folder to be picked up automatically? Do I need to include it in my init.py or do I have to add it in the main configuration.yaml?

#

Thanks!

gloomy berry
#

Why would you have automations.yaml in custom_components?

#

It belongs in your config directory and needs to be included from configuration.yaml. It has nothing to do with custom components

wide shell
#

I am most likely doing it wrong. My componet manages a swarm of esphome devices. I want the component to be able to control various aspects of the devices. Automations look like the way to go. I wanted to keep everything compartmentalized in my custom component so it is self contained.

Sample Automation:

  trigger:
    - platform: event
      event_type: light_turn_on_event
  action:
    - service: system_log.write
      data:
        message: "Event data: {{ trigger.event.data }}"
        level: info
    - service: light.turn_on
      target:
        entity_id: "{{ trigger.event.data.target }}"
      data:
        brightness_pct: "{{ trigger.event.data.brightness }}"
        rgb_color: "{{ trigger.event.data.rgb_color }}"
        effect: "fill_solid"```
#

Here is what I have added to the main configuration.yaml:

automation connected_button: !include custom_components/connected_button/automations.yaml```
gloomy berry
#

Have you actually written a custom integration for HA?

wide shell
#

I think so... init.py and all the other files that go with it?

#

It shows up with the configured dashboard

gloomy berry
#

Ok. I wouldn't suggest putting automation.yaml in there because it has nothing to do with it

wide shell
#

Automations seems like the easiest way to set the values on my led segments

gloomy berry
#

Ok

wide shell
#

The api exists because when I click the name of a led segment, I can see brightness, color and effect

#

What is the best way to get/set those values?

gloomy berry
#

Seems like you could do everything in your integration

wide shell
#

I am trying to use as much existing functionality as possible.

#

What other mechanism do you suggest?

#

This is my 1st deep dive into ha

gloomy berry
#

You've written an integration in Python and can do anything there

wide shell
#

Right, but lets say I have my esphome devices. Each has button_leds and body_leds among other things. How should my component get and set brightness, color and effect on those two light segments?

Is it just as easy as light.entity_name.rgbColor = [0,0,0]

#

cause that would be amazing

gloomy berry
#

No, you call services

wide shell
#

services 🤔

gloomy berry
#

I'm not sure how you wrote an integration

wide shell
#

Is there a way to discover what services are available for a device or entity?

gloomy berry
#

Please go to channels & roles and select the developer option

#

There are developer channels

wide shell
#

Thanks for the info!

wide shell