Dynamic Input State Selector

Hello,
Hope one of you awesome people can help with this. Looked everywhere and cant find anything. Working on a blueprint for “topping off” solar batteries before the utility rate changes to peak. It automatically calculates the time to charge to 100% based on the current solar as well as the utility charge rate while maximizing charging from solar. Most of it is done and it works but I would like to make this work for all users and not just myself. Because who knows what their entities are named.

So in this blueprint it should only run when an entity is in a specific state. This entity basically has a list of states.

For example: the entity has the select domain and the following options:

  - Utility first
  - Solar first
  - Solar and utility simultaneously
  - Solar only

I would like to be able to use the state selector for the user to choose the correct state but this selector requires hard coding the entity_id. Again, who knows what their entities are named. For example this works:

blueprint:
  input
    test:
      name: state selector test
      selector:
        state:
          entity_id: select.mobile_solar_charger_source_priority

and produces this

But I would like the entity_id to be selected by the user as well. There is already an input for this but can’t figure out how to use the output of an input as the input for another input, lol.

Something like this would be great, however it appears inputs do not accept templates or outputs from the variables block.

blueprint:
  input
    dvInvrtrOtptSrc:
      name: Inverter Output Source
      description: Select the entity that represents the inverter's output source.
      default: ""
      selector:
        entity:
          domain: select
    test:
      name: state selector test
      selector:
        state:
          entity_id: !input dvInvrtrOtptSrc

Can anyone recommend anything that would allow a user to select an entity, then select one (or more) of the states of that entity?

There is no user code running when building the calling automation in the UI, so there is no way to use the input as an output. I don’t know if there is a state selector like you are wanting either. I haven’t run into one anyway.

I do think the entity selector is going to change in the next release. I don’t know how but I bet if you install the beta version of HA you will see it. What I do know is as of last week the selector/state/domain formatting is deprecated in the HA code server extension and that is not a bug, so something is changing. I would hold off finishing this until after the next release to see what is happening.

Also this may fit in this thread better than here until you get something working.

Once it gets working and you want to share it, this is the perfect spot.

You can easily move it by editing the top and changing the location.

1 Like