Getting entity_id from input

I have a working automation and trying to make it a blueprint.
Automation:

trigger:
    - type: power
      platform: device
      device_id: 9fc867b39427cefcbc3dda4b33ae8549
      entity_id: ea80e231c8789f6ff011d33292ccc5bc
      domain: sensor
      above: 2
      id: tool-starts-being-used
      alias: Tool starts being used

in blueprint I did

blueprint:
  domain: automation
  input:
    power_outlet:
      name: Power outlet
      selector:
        entity:
          filter:
            - domain: switch
            - device_class: outlet
trigger:
    - type: power
      platform: device
      device_id: !input power_outlet
      entity_id: ????????????????????
      domain: sensor
      above: 2
      id: tool-starts-being-used
      alias: Tool starts being used

but I can’t understand how to get entity_id
I see state I need is sensor.node_4_electric_consumption_w and as far as I understand sensor.node_4 is my device_id but I struggle to understand how do I get electric_consumption_w from input

The entity selector you are using is going to return an entity id, but you need to configure it to get sensor entities, not switch entities.

No. A device_id is always a random-looking alphanumeric string like a25920adf0279ae1755cdac06b522a79 .

I don’t work with blueprints much, but I would be very surprised if Device triggers are allowed at all… you should probably be using a Numeric state trigger.

blueprint:
  domain: automation
  input:
    power_outlet:
      name: Power outlet
      selector:
        entity:
          filter:
            - domain: sensor
              device_class: power

trigger:
  - platform: numeric_state
    entity_id: !input power_outlet
    above: 2
    id: tool-starts-being-used 
    alias: Tool starts being used
1 Like

You can do a device trigger, but there is NO advantage that I know of to torture yourself that way.
Device triggers that populate themselves (basically) in the UI editor use the device triggers because, I don’t know, it probably is closer to the machine type code that is in the back end maybe. The entity triggers are easier to understand and troubleshoot unless you are a machine, IMHO.

Turn on the ‘ea80e231c8789f6ff011d33292ccc5bc’ connected thru the ’
9fc867b39427cefcbc3dda4b33ae8549’
OR
Turn on the ‘!input power_outlet’.

What makes more sense to you and gives you SOME ability to troubleshoot it, assuming you are not a machine?

Thanks for the answers - I think I’m starting to understand the hierarchy. Device is a physical hardware. Entity is “interface” it is implementing like “sensor” or “power”. State gets data from entities.
Reading through the docs over and over.

Ok, I’m much smarter now. Avoiding device triggers and device actions :wink:
Something I still struggling with is getting entity from device. I’m trying to let user select single device so I could perform different actions on it - read sensor, turn it on and off etc.
I have my physical switch.

  input:
    switch_tool:
      name: Tool switch
      description: Tool that turns the tool ON&OFF
      selector:
        target:
          entity:
            domain: switch

Now I try to create a trigger when wattage on device is higher than a threshold.
I know that device has power sensor that is represented by separate entity but I don’t understand how do I retrieve that entity from device? I can workaround this by making user select power entity for this device as a separate input but it will be nice to let them select single device that I would deal in automation.

  - alias: Tool starts being used
    id: tool-starts-being-used
    platform: numeric_state
    entity_id: !input switch_tool # ??? I need to get power sensor entity here
    attribute: electric_consumption_w
    above: 1

Templating - Home Assistant.

If one of the suggestions listed solves your problem, please consider clicking the solution button to close the thread.

Ok, got it - I thought I’m missing something obvious.
I think I will just use multiple inputs for different entities. Thanks a lot for patiently answering at noob questions!