New helper device or entity

Hi all,

I’m pretty new to HA - coming from Symcon and currently testing several things, if I really can replace my current system. So, I’m not new to home automation at all.

Currently I’m trying to figure out how to solve following topic:

  • I’ve a shelly switch where my 3d printer and an octoprint raspi is connected.
    Now I want to create a new switch and a state string, which should be shown in an dashboard.
  1. when I turn on the new switch:
    • Shelly switch should be turned on
    • state string should be “booting”
  2. When one of the Octoprint sensors going to any state but “Unavailable”
    • state string switching to “on”
  3. when I then turn off the new switch:
    • trigger Octoprint shutdown
    • state string should then be “shutting down”
  4. after 60 seconds
  • state string should switch to “off”

especially the state string drives me crazy how to implement it. I tried several things, i.e. template helper select. - all others may be a topic of automation, but I didn’t get to that point right now.

Thanks for your support,
Philipp

Hi @superflip - welcome to the forum!

A switch can only be in an on or an off state, so it can’t show four separate states.
I’d probably use an input_text helper for that, display its state and ‘fill’ its state from an automation that works with trigger ids, similar to this - the on and of sequence can be triggered in the dashboard with a tap action on the helper or an additional button:

alias: Set Garage Door Detailed Status
description: ""
mode: single
triggers:
  - entity_id:
      - binary_sensor.xa_ds_gd_contact
    from: "off"
    to: "on"
    id: Opening
    trigger: state
  - entity_id:
      - binary_sensor.xa_ds_gd_contact
    from: "on"
    to: "off"
    id: Closed
    trigger: state
  - entity_id:
      - cover.garage_door
    from: closed
    to: open
    id: Open
    trigger: state
  - entity_id:
      - cover.garage_door
    from: open
    to: closed
    id: Closing
    trigger: state
conditions: []
actions:
  - data:
      value: "{{ (trigger.id) }}"
    target:
      entity_id: input_text.garage_door_status
    action: input_text.set_value

Trigger 1: when the state of the Shelly changes to ‘on’, use the id ‘booting’ to set the input_text.set_value
Trigger 2: when the state any of the Octoprint sensors chages 'from: unavailable, use the id ‘on’
Trigger 3: when the new switch changes to ‘off’, use the id ‘shutdown’ and create another automation that triggers when the state of the input_text changes to ‘shutdown’ and actually carries out the Octoprint shutdown
Trigger 4: when the new switch has been in the state ‘shutdown’ for 60 seconds, use the id ‘off’

Note:
This can probably also be achieved in a template trigger sensor in the configuration.yaml directly rather than with the automation, but that’s how I would address it.

1 Like

thanks for your detailed answer - I will try to configure it as described.

so, thanks to your description, I got the hints I needed!

I now got it running with Node-Red … and I’m loving it!

Works like a charm.

Only thing I want to improve is the dashboard now:
I want to make the Status read-only - at the moment, someone could write any text in …
grafik

Can I set this to read-only in any way?

Thanks again,
Phil

1 Like

Modify your entities card yaml like this to make it uneditable from that card.

type: entities
entities:
  - entity: input_text.zzzz
    type: simple-entity

If you truly want a string that is read-only everywhere, I would create a template sensor.

1 Like

this works fine and looks as expected.

I’m not familiar with template sensors right now and I do not know, what to fill in there - mayber at a later point I will dig into that deeper.

Thanks all for your awesome support!