@Stoli wrote:
I am trying to make an input_number slider entity work with an mqtt roller shade. I have 2 automations, the first sets the input_number value when triggered by an mqtt (Set Shade1 slider), and the second sends an mqtt when the slider is moved in the gui (Shade1 slider moved). The mqtt format for the shade is simple. When it is sent a value between 0 and 100 (percentage of closed), it will first send out a json with its current position (position) and the new setting (set). After the shade has completed moving, it sends out another json with the current status (position and setting) and in this transmission, they are always the same (the new set position).
i.e. Assuming current position is 10.
when shade is sent payload: 20
shade returns “set”: 20, “position”: 10
after it finishes moving, shade returns “set”:20, “position”:20Both automations will work individually (when the other is removed), but when both are present, the shade will move to the new position (as set by the slider or an external source), but then it will move back up to zero in single step increments.
input_number: shade1: name: Shade1 mode: slider initial: 0 min: 0 max: 100 step: 10 icon: mdi:blinds automation: - alias: "Set Shade1 slider" trigger: platform: mqtt topic: /raw/esp8266/6831410/out condition: - condition: template value_template: "{{ trigger.payload_json.set == trigger.payload_json.position }}" action: - service: input_number.set_value data_template: entity_id: input_number.shade1 value: "{{ trigger.payload_json.position | int }}" - alias: "Shade1 slider moved" trigger: platform: state entity_id: input_number.shade1 action: - service: mqtt.publish data_template: topic: /raw/esp8266/6831410/in retain: true payload: "{{ states('input_number.shade1') | int }}"
Thanks
Posts: 3
Participants: 2