How to create template for day/night blinds?

Hi!

I am new to HA and still absorbing the vast knowledge of this ecosystem so please bear with me.

I have a set of Graywind Motorized Day/Night Cellular Shades connected to HA via Zigbee. These identify as Tuya TS0301 covers and expose battery, state, position, and tilt (tilt is not available with these blinds as they are cellular). The blinds (lets call them daynight_blinds) have a single motor and can be controlled via the position such that values between [0-50] correspond to the blackout blinds opening and closing and [51-100] controls the position of the day blinds.

While this works, I would ideally like to be able to control the day and night blinds individually using two sliders in the dashboard.

My initial thought on how to achieve this is to create a cover template (lets call it daynight_custom) which maps values between [0-50] of the position from daynight_blinds to values between [0-100] of the position of daynight_costum, and values between [51-100] from daynight_blinds to [0-100] of the tilt for daynight_custom, essentially hijacking this attribute.

Ideally, this should work both ways, i.e. if I set any value on position or tilt of daynight_custom, the corresponding value is set in daynight_blinds. If I set any value in position on daynight_blinds, the corresponding values in position and tilt in daynight_custom should be set. Equally, I would need to assure that position and tilt do not conflict with each other, i.e. tilt must be set to 0 if position is any other value that 0, and position is set to 0 if tilt has any other value than 0.

Finally, I am planning on purchasing additional day/night blinds and it would be great if the final code could be reused by only switching the name of the blind to be controlled, e.g. using anchors.

Is the above a good approach in your opinion? What would be the best way to implement this? I have only gotten so far as to set the state of daynight_custom to the state of daynight_blinds, but I am struggling to comprehend the logic of the remaining fields.

cover:
  - platform: template
    covers:
      daynight_custom:
        device_class: blind
        friendly_name: "Smart Blinds Custom Controller"
        value_template: "{{ states('cover.daynight_blinds') }}"
        open_cover:
          action: ?
        close_cover:
          action: ?
        stop_cover:
          action: ?
        #use this to control blackout blind postion
        set_cover_position:  ?
        #use tilt to control day blind position
        set_cover_tilt_position: ?

Thank you in advance for your help!

1 Like

I was just looking at their Day/Night blinds and wondering how Home Assistant would see it - as one blind or as two? I think your explanation of two ranges clears that up for me! Thank you!

How do you like them now almost 6 months later? Any wear and tear yet?

I’m considering them for a southern-exposure 72" wide bay window in a room I use as a home theater at night - would you think their full blackout portion is suitable for me?

@drivenbyentropy Actually, one more question with these:

In order to go from Open to Blackout mode, do they basically first have to go to 100% sheer, then raise the blackout portion? How long does that actually take? Is it annoying?

@drivenbyentropy - Not sure if you are still pondering this. You’ll need to adjust your ‘value_template’ to map 0-50 => 0-100 etc. For the actions, you’ll need to do send an action to the blind to open to 50%, or 0% instead of the normal Open Close actions. As far as reusing your code is concerned, I can’t think of a way to do that within a template.

@Ingo
For me, they go 100% sheer and then raise the blockout portion.
I had to add support for my blinds to Z2M myself, so I exposed 2 blinds within Z2M itself.
Generally speaking, day-night blinds come in two basic forms: single motor (as described by the OP), and dual motor (which provide independent control of the two parts)

Different manufactures use different motors, so speed of deployment will vary.