Skip to content

Instantly share code, notes, and snippets.

@ollidiemaus
Forked from marlomgirardi/cover_position_fix.yaml
Last active July 12, 2025 13:46
Show Gist options
  • Save ollidiemaus/7131afab654d666fda34ad26991f69de to your computer and use it in GitHub Desktop.
Save ollidiemaus/7131afab654d666fda34ad26991f69de to your computer and use it in GitHub Desktop.
TS130F by _TZ3210_dwytrmda position fix
blueprint:
name: Shutter Position Fix (Zigbee2MQTT)
description: A fix for TS130F shutter position using Zigbee2MQTT
domain: automation
author: Adapted by ChatGPT
input:
shutter_entity:
name: Shutter to be fixed
selector:
entity:
filter:
device_class: shutter
domain: cover
integration: mqtt
mqtt_device_name:
name: Zigbee2MQTT device name (as used in MQTT topic)
description: Usually the name shown in Zigbee2MQTT UI, e.g. "Wohnzimmer_Rollo"
selector:
text:
mode: restart
trigger:
- platform: state
entity_id: !input shutter_entity
attribute: current_position
- platform: state
entity_id: !input shutter_entity
attribute: current_position
id: stuck_1
to: "1"
for: "00:00:30"
- platform: state
entity_id: !input shutter_entity
attribute: current_position
id: stuck_99
to: "99"
for: "00:00:30"
- platform: state
entity_id: !input shutter_entity
id: stuck_opening
to: opening
for: "00:01:00"
- platform: state
entity_id: !input shutter_entity
id: stuck_closing
to: closing
for: "00:01:00"
condition:
- condition: numeric_state
entity_id: !input shutter_entity
attribute: current_position
above: -1
below: 101
action:
- variables:
position: "{{ state_attr(trigger.entity_id, 'current_position') }}"
mqtt_device: !input mqtt_device_name
- choose:
- conditions:
- condition: trigger
id:
- stuck_1
- stuck_closing
sequence:
- service: mqtt.publish
data:
topic: "zigbee2mqtt/{{ mqtt_device }}/set"
payload: '{"position": 0}'
alias: Force current position to 0
- service: cover.stop_cover
target:
entity_id: !input shutter_entity
- conditions:
- condition: trigger
id:
- stuck_99
- stuck_opening
sequence:
- service: mqtt.publish
data:
topic: "zigbee2mqtt/{{ mqtt_device }}/set"
payload: '{"position": 100}'
alias: Force current position to 100
- service: cover.stop_cover
target:
entity_id: !input shutter_entity
default:
- delay:
seconds: 5
alias: When multiple triggers, make sure only the last one runs
- service: mqtt.publish
data:
topic: "zigbee2mqtt/{{ mqtt_device }}/set"
payload: '{"position": {{ position | int }}}'
alias: Update reported position via MQTT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment