Tasmota blinds losing calibration on power outage - workaround?

Hello. I have several sonoff Dualr2 devices flashed with tasmota to make blinds work, but when I have a power outage they lose calibration, so I have to make them go up until the end and then I can use them again.

Maybe it’s a tasmota issue or something I didn’t set up fine, but until I figure it out I thought that I could make HA keep the % in an input number so if I detect a power outage, the blinds can go up, wait several seconds and then go to the same position, but I am stuck.

I created this input_number:

posicion_persiana_lavadero_puerta:
    name: Posición Persiana Lavadero Puerta
    min: 0
    max: 100
    step: 1
    unit_of_measurement: '%'
    mode: slider

Then I created this automation:

alias: Persiana LavaderoP -> Estado
description: ""
trigger:
  - platform: state
    entity_id:
      - cover.persiana_lavaderop_cover_1
condition: []
action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.persiana_posicion
      value: "{{ trigger.to_state.state }}"
mode: single

But it doesn’t update when I move the blind. Any help?

Ok. Solved. I had to point to attribute “position” instead of entity

Hi, did you investigated more and found a way to fix without an automation? and in the meantime did you updated the code based on your second post? It seems it still uses entity_id as trigger.

No, I didn’t. When I have a power outage some blinds seems to forget their position.

can you show full working automation? I think that while investigating i can use your workaround

Hi, I have same problem. Out of 4 blinds 2 forget their position after an outage. Does some option set this behavior? I dont remember setting such behavior explicitly ever, but maybe I really just dont remember.
Example from today: all blinds were open, then power outage occured, and after it was over, two blinds were in closed state in tasmota. Then evening automation hit and it closed all blinds except those, that were falsely in closed state.

My workaround is a bit complicated:

  1. I have an automation that sets an imput number everytime a blind moves, so home assistant really knows where it is BEFORE a power outage:
alias: Persiana Cocina -> Estado
description: ""
trigger:
  - platform: state
    entity_id:
      - cover.persiana_cocina_cover_1
    attribute: current_position
condition: []
action:
  - service: input_number.set_value
    entity_id: input_number.posicion_persiana_cocina
    data_template:
      value: "{{ trigger.to_state.attributes.current_position }}"
mode: single

This have to be set for every blind, so in my house I have 14 of these automations.

  1. I have another automation that calls an script if I have a power outage in hours when my children are awake:
alias: Corte de luz -> Persianas de arriba
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.power_outage
    attribute: acStatus
    from: ok
    to: error
condition:
  - condition: time
    after: "09:05:00"
    before: "15:30:00"
  - condition: time
    after: "17:20:00"
    before: "21:00:00"
action:
  - service: script.1691596479324
    data: {}
mode: single
  1. The script does the following: disables all automations from 1, then completely opens all the blinds, waits for a minute (so it be sure that blind is completely open), then sets the blind to the position previous to the power outage, enables all automations again and then sets the position in the input number again:
alias: Persianas P1 Restaurar
sequence:
  - service: automation.turn_off
    data:
      stop_actions: true
    target:
      entity_id:
        - automation.persiana_cocina_estado
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - device_id: 6174cd9facc81b4f10f7800546a3a513
    domain: cover
    entity_id: cover.persiana_cocina
    type: set_position
    position: 100

  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: cover.set_cover_position
    data:
      position: "{{ states('input_number.posicion_persiana_cocina') | int }}"
    target:
      device_id: 2edbfacd08d1a57d1c2a531a510ed144
  - service: automation.turn_on
    data:
      stop_actions: true
    target:
      entity_id:
        - automation.persiana_cocina_estado
  - service: input_number.set_value
    entity_id: input_number.posicion_persiana_cocina
    data_template:
      value: "{{ trigger.to_state.attributes.current_position }}"
mode: single
icon: mdi:blinds-open

I know it’s not clean and probably there is a better approach (as @t.srubar stated, maybe there is an option that I set in some blinds and not in others?) but until somebody find another solution seems enough for me.

1 Like

Wow! Thank you very much for your code and the description!

I’ll study them and adapt to my needs