Mqtt: same settings different result

hello all,

I have a question that I am not quite getting out of. I have folding blinds that consist of a motor and a usb dongle, flashed with Tasmota. I would like to get the blinds into home assistant using mqtt. To do this, I followed a guide from Blakadder.

One of the options is to get a slider, which allows you to change the direction. What I don’t understand now is that with blinds 1 (vouwgordijn 1) I get the slider and with blinds 2 (vouwgordijn 2) I don’t get a slider, but a different icon. And that with the same settings?

How is this possible?

Blinds 1

Blinds 2

Below my configuration.yaml settings:

mqtt:
  switch:
  - name: "Motor Direction 1"
    icon: mdi:blinds
    state_topic: "tele/zemismart1/RESULT"
    state_on: 1
    state_off: 0
    value_template: >-
        {% if value_json['TuyaReceived'].DpType1Id5 is defined %}
        {{ value_json.TuyaReceived.DpType1Id5 }}
        {% else %}  
        {{ states('switch.motor_direction1') }}
        {% endif %}  
    command_topic: "cmnd/zemismart1/TuyaSend"
    payload_on: "5,1"
    payload_off: "5,0"
    availability_topic: "tele/zemismart1/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"

  - name: "Motor Direction 2"
    icon: mdi:blinds
    state_topic: "tele/zemismart2/RESULT"
    state_on: 1
    state_off: 0
    value_template: >-
        {% if value_json['TuyaReceived'].DpType1Id5 is defined %}
        {{ value_json.TuyaReceived.DpType1Id5 }}
        {% else %}  
        {{ states('switch.motor_direction2') }}
        {% endif %}  
    command_topic: "cmnd/zemismart2/TuyaSend"
    payload_on: "5,1"
    payload_off: "5,0"
    availability_topic: "tele/zemismart2/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"

Thanks in advance!

Kind regards

Johan

The log now shows the error message below. Anyone who can explain this to me?

Exception in position_message_received when handling msg on 'tele/zemismart1/RESULT': '{"TuyaReceived":{"Data":"55AA030000010104","Cmnd":0,"CmndData":"01"}}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 44, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/cover.py", line 410, in position_message_received payload: ReceivePayloadType = self._get_position_template(msg.payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 233, in async_render_with_possible_json_value self._value_template.async_render_with_possible_json_value( File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 589, in async_render_with_possible_json_value return _render_with_context(self.template, compiled, **variables).strip() File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1950, in _render_with_context return template.render(**kwargs) File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "<template>", line 1, in top-level template code File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1729, in forgiving_int_filter raise_no_default("int", value) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1411, in raise_no_default raise ValueError( ValueError: Template error: int got invalid input 'None' when rendering template '{% if value_json['TuyaReceived']['DpType2Id3'] is undefined %} {{ 100 - state_attr('cover.shades','current_position') | int }} {% else %} {{ value_json['TuyaReceived']['DpType2Id3'] | int }} {% endif %}' but no default was specified