Sonoff dual configured with external switches does not communicate correctly with MQTT

Hello,
i am pretty newbie for this topics, but i’m trying to setup my home domotic.
I installed in my house the sonoff dual R2 (tasmota firmware) connected to external switches with the current configuration:

GPIO0 Button1 = Switch1 (9)
GPIO1 Serial Out = None (0)
GPIO3 Serial In = None (0)
GPIO9 ESP8285 = Switch1 (9)

Then i installed the switches into home assistant (i use mosquitto as MQTT) with the following command lines:

switch:

  • platform: mqtt
    name: “camera”
    STATE_TOPIC: “stat/sonoff-camere/POWER1”
    command_topic: “cmnd/sonoff-camere/power1”
    optimistic: false
    payload_on: “ON”
    payload_off: “OFF”
    retain: true
  • platform: mqtt
    name: “cameretta”
    STATE_TOPIC: “stat/sonoff-camere/POWER2”
    command_topic: “cmnd/sonoff-camere/power2”
    optimistic: false
    payload_on: “ON”
    payload_off: “OFF”
    retain: true

Problem is: if i use the external switches home assistant is not updated and see the switch as off even if it’s on. this happens even if i control the switch thorugh it’s ip address web page.
If i turn the switch of from home assistant the ip web page of the sonoff is correctly updated.

please help me!!

thanks