Controlling opening and closing of electric clerestory windows

My next project is to include the opening and closing of our electrically controlled clerestory windows into HA. But I am not exactly sure how to include that into Lovelace / Frontend

The opening and closing of the windows will be controlled by Sonoff minis.
Basically to open the windows I have to give the “open window” sonoff mini the command to switch on, this in turn will start the electric actuators to open the windows. Within Tasmota I’ve set-it up so that the Sonoff mini will automatically switch off again after 20 seconds. (That’s how long it takes to actuate the windows.)

To close the windows is very similar, but I give another sonoff mini (the “close window” one) the switch on command. Which again will automatically switch off and stop actuating the window after 20 seconds.

Where I am unsure on how to represent / control that in the HA fronted / Lovelace is that I’d like one button or maybe picture element that remembers if I’ve opened or closed the windows. Obviously in the resting state both the “open windows” and the “close windows” sonoff minis would report back that they are switched off, so the minis are not much use in determining if the windows are open or not.

My thinking is that I somehow have HA remember if I last opened or closed the windows without needing to check a sensor / switch. But how would I do that?

Any pointers to further reading or examples would be much appreciated.

Cheers

You could create an input_select which gets switched between open and close each time the corresponding Sonoff is activated.

So where does the input select go?

Does it go in a sensor definition or is it part of a Lovelace card definition?

Any examples you are aware of?

You would create it as another entity, so in your configuration.yaml or if you use Packages, then in a package file. I strongly suggest using Packages as they make your code easier to manage

I’ll put together an example soon

Thanks Sparky… that gives me a start on what to look at.

Not sure what you mean by packages… I use !include in my configuration.yaml file like:

sensor solar: !include sensors/solar.yaml
2 Likes

Example input_select for you

input_select:
  clerestory_window_1:
    name: Clerestory Window
    icon: mdi:window-closed
    options:
      - Closed
      - Open
    initial: Closed

then in your ‘open window’ automation / script you could include:

    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.clerestory_window_1
          option: Open
1 Like

Thanks Dave for both the link to the packages documentation and the example.

I very much appreciate your help. Now just waiting for those Sonoff mini’s to arrive… They’ve been in the mail for a while, taking the scenic route around Queensland, thanks to Australia post… :slight_smile:

I’ll check back in once I’ve implemented it.

No worries.

If you haven’t come across it yet, there is a very good thread for us Aussies where heaps of products are discussed, mainly where we try to flash Tasmota / ESPhome onto them to remove cloud dependencies.

1 Like

Yes, saw that thread. Lots of interesting stuff talked about in there :slight_smile: