arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
21.7k stars 4.72k forks source link

Sends wrong mqtt? #21577

Closed Magnus-rosenborg closed 3 weeks ago

Magnus-rosenborg commented 3 weeks ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is. My device is a sonoff touch wall switch with 3 buttons. ( T1EU3C) I have tried the template for it and also setting it by myself using the generic template. The problem is that it sends POWER1 on every button shoudn't it be POWER2 for button 2 end so on? See the image for more details.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

- [X ] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [ X] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:
14:10:53.127 MQT: cmnd/KNAPP37/POWER1 = 1 (bevarad)
14:10:53.131 MQT: stat/37/RESULT = {"Button4":{"Action":"SINGLE"}}
14:10:53.275 SRC: MQTT
14:10:53.278 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 1, Data '1'
14:10:53.283 MQT: stat/37/RESULT = {"POWER1":"1"}
14:10:53.424 CFG: Sparade till flash vid F8, Räkna 156, Bytes 4096
14:10:53.691 MQT: cmnd/KNAPP37/POWER1 = 1 (bevarad)
14:10:53.698 MQT: stat/37/RESULT = {"Button4":{"Action":"CLEAR"}}
14:10:53.936 SRC: MQTT
14:10:53.939 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 0, Data '0'
14:10:53.945 MQT: stat/37/RESULT = {"POWER1":"0"}
14:10:54.374 CFG: Sparade till flash vid F7, Räkna 157, Bytes 4096
14:11:04.515 WIF: Kontrollerar anslutning...
14:11:14.851 MQT: cmnd/KNAPP37/POWER1 = 1 (bevarad)
14:11:14.858 MQT: stat/37/RESULT = {"Button5":{"Action":"SINGLE"}}
14:11:14.946 SRC: MQTT
14:11:14.949 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 1, Data '1'
14:11:14.954 MQT: stat/37/RESULT = {"POWER1":"1"}
14:11:15.405 CFG: Sparade till flash vid F6, Räkna 158, Bytes 4096
14:11:16.419 MQT: cmnd/KNAPP37/POWER1 = 1 (bevarad)
14:11:16.425 MQT: stat/37/RESULT = {"Button5":{"Action":"CLEAR"}}
14:11:16.516 SRC: MQTT
14:11:16.519 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 0, Data '0'
14:11:16.525 MQT: stat/37/RESULT = {"POWER1":"0"}
14:11:17.404 CFG: Sparade till flash vid F5, Räkna 159, Bytes 4096
14:11:20.521 MQT: cmnd/KNAPP37/POWER1 = 1 (bevarad)
14:11:20.527 MQT: stat/37/RESULT = {"Button6":{"Action":"SINGLE"}}
14:11:20.620 SRC: MQTT
14:11:20.623 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 1, Data '1'
14:11:20.629 MQT: stat/37/RESULT = {"POWER1":"1"}
14:11:21.408 CFG: Sparade till flash vid F4, Räkna 160, Bytes 4096
14:11:22.669 MQT: cmnd/KNAPP37/POWER1 = 1 (bevarad)
14:11:22.675 MQT: stat/37/RESULT = {"Button6":{"Action":"CLEAR"}}
14:11:22.767 SRC: MQTT
14:11:22.770 CMD: Grp 0, Cmd 'POWER', Idx 1, Len 1, Pld 0, Data '0'
14:11:22.775 MQT: stat/37/RESULT = {"POWER1":"0"}
14:11:23.404 CFG: Sparade till flash vid FB, Räkna 161, Bytes 4096

TO REPRODUCE

Steps to reproduce the behavior: I have tried to have button 1,2,3 and like 4,5,6 no difference. Even when detach buttons using SO114 still sends mqtt like power1 1 on button 4. So strange!!! It works fine in gui. But not the touch buttons.

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen. if button 4 is pressed should send power4 1 or power4 0

SCREENSHOTS

If applicable, add screenshots to help explain your problem. image image

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

sfromis commented 3 weeks ago

Publishing payloads with POWER has nothing directly to do with what button is being pushed, but is instead about what relay is changing state. But indirectly, the default action for button/switch inputs is to toggle power.

You are not creating any relationship between buttons and relays by the number, the only thing that matters is the sequence, and indexes you assign per component type has to start at 1, and not skip any numbers.

SetOption114 (which is for Switch inputs) is not doing anything when inputs are configured as a Button, that would be SetOption73.

If you've been messing around with ButtonTopic, better not do that, without fully understanding this specialized command. In fact, I'd recommend going back to initial configuration, and not heaping different config options on top on each other. Your mixup of topics with KNAPP37 and just 37 also looks like your config is too much combination of attempts of doing something.