My z-wave blinds only have these states:
{'current_position': 100, 'device_class': 'window', 'friendly_name': 'Kitchen Blinds', 'supported_features': <CoverEntityFeature.STOP|SET_POSITION|CLOSE|OPEN: 15>}
Basically “open”, “closed”, and an attribute for it’s current position (0-100).
I can update the state of a button card to show when it’s “opening” or “closing” - to do this, I used an input_select helper to display on the button card.
What I’m trying to do now, is if I set the blinds to a specific percentage, i.e. - 60% and then I make the set_position service call to 80% (opens more), I want my button card icon to update with an arrow up or down as it’s transiting.
My question: Is there a way to store the called value of the service call to compare it to the current set position to determine which way the blinds are moving?
If it helps, the button card press calls an automation to update the input_select helper. Automation yaml code:
alias: "Blinds: Helper Kitchen Set Icon"
description: ""
trigger:
- platform: state
entity_id:
- cover.kitchen_blinds
to: open
id: opening_to_open
- platform: state
entity_id:
- cover.kitchen_blinds
id: closing_to_closed
to: closed
- platform: event
event_type: call_service
event_data:
domain: cover
service: set_cover_position
id: cover_position
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: opening_to_open
- condition: numeric_state
entity_id: cover.kitchen_blinds
attribute: current_position
above: "95"
sequence:
- service: input_select.select_option
data:
option: open
target:
entity_id: input_select.blinds_kitchen_helper
- conditions:
- condition: trigger
id: closing_to_closed
- condition: numeric_state
entity_id: cover.kitchen_blinds
attribute: current_position
below: "5"
sequence:
- service: input_select.select_option
data:
option: closed
target:
entity_id: input_select.blinds_kitchen_helper
- conditions:
- condition: trigger
id: cover_position
sequence: [] # *********** this is the part I need help with, some sort of comparison to current state and called state **********
default:
- if:
- condition: state
entity_id: cover.kitchen_blinds
state: closed
then:
- service: input_select.select_option
data:
option: opening
target:
entity_id: input_select.blinds_kitchen_helper
- service: cover.open_cover
data: {}
target:
entity_id: cover.kitchen_blinds
else:
- service: input_select.select_option
data:
option: closing
target:
entity_id: input_select.blinds_kitchen_helper
- service: cover.close_cover
data: {}
target:
entity_id: cover.kitchen_blinds
mode: single