Switch with curtain/cover visualisation?

Hi guys

I have searched quite a lot but haven’t found an answer yet to my problem so I’m hoping I can get some help here.

I have switches that control curtains through a simple KNX actuator, this is one of them:

switch:
  - platform: knx
    name: curtain.f1
    address: '0/0/1'
    state_address: '0/2/0'

This works fine and the state address represent the actual position.
Now I’m looking for a way to change the switch button with a curtain/cover and of course a way to see/know the current position.

Can any of you put a newbie in the right direction please?
Thanks a lot in advance!
Nick

Take a look at the Template Cover.

Hi VDRainer!

Thanks for that tip.
I did see that part of the documentation but I cannot see how to bend a switch to this… :blush:

Can you (or someone else) elaborate a little please?

TIA
Nick

Then you should also read it.
There’s an example that uses switches.

Got it - sort of - working now with 2 minor things:

  • the visualization is a vertical curtain while the actual situation are horizontal ones
  • the state doesn’t follow when the control is done from KNX, which it does with a button by using that state_address

configuration.yaml:

switch:
  - platform: knx
    name: curtain.a1
    address: '0/0/1'
    state_address: '0/2/0'
cover:
  - platform: template
    covers:
      curtain_a1:
        device_class: curtain
        friendly_name: "Curtain back left"
        open_cover:
          service: switch.turn_on
          data:
            entity_id: switch.curtain_a1
        close_cover:
          service: switch.turn_off
          data:
            entity_id: switch.curtain_a1

Regarding the visualization: I have searched for the available icons but haven’t found anything for horizontal curtains. (also changed the device class)
Do they exist and if yes, where can I find them.
If not, I guess I can create something myself but have no idea howto approach this.

For the state, do I use that value_template as in the example?

Thanks
Nick

I think the curtain works like a normal shutter.
You should use the cover configuration: https://www.home-assistant.io/integrations/cover.knx/
To know the state you will need the “position_state_address”

Hi Joca

Thanks for the tip: I did see that doc but it seems that it doesn’t add anything to the solution.
Since I’m fairly new to home automation in general and HA, this is what I puzzled together.

In this case there is a normal actuator that controls relays, that were already in place, and it’s to much to change all this.
Therefor I have only the control to fully open/close and the state; that’s why I used a switch.

Nick