get button inputs from port expander MCP23017 via MQTT messages #23707
-
Hi, I do have an older custom build with three MCP23017 port expanders connected, which is working perfectly. Up to now I used the expanders just for outputs, but now I do want to use some of the I/Os as an input. Physically connected are regular push buttons, non-latching. Corresponding I/O PIN of the MCP23017 is connected to one pin of the button, other side to GND, meaning I don't have hardwired pull-up or -down resistors connected. The I/O is tied via button to GND. Due to MCP I'm not usign the "7" as input, that one is configured always as output. To get a more robust signal, the internal pull-ups of the MCP should be used. Also I don't want to have any coupling to the outputs. And I do want to get any input change reported directly (and not heavily delayed).
First I tried with Button1..32 config, now with Switch1..28 config. But both dis not worked...
but on MQTT I couldn't see anything. Also I don't want to have some "TOGGLE" command, my intention is to get two messages: first if a button press is recognized and second if release is deteted.
What is going wrong here? Or how do I need to configure the port expanders? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
The log messages you posted are when MQTT messages are published, showing topic and payload. Seeing them does suggest that your MCP23017 config is workable. Looks like you have configured a fulltopic to break the standard Tasmota topic conventions, but that should not make the messages "invisible" if your checking for messages is using a suitable tool and subscription mask. |
Beta Was this translation helpful? Give feedback.
-
Hi, there is no MQTT message. Checked it directly on the broker and also with a spying tool on my PC.
is reported for every configured input. Inputs are stable, will check in the afternoon with a scope to have a proof. And will very likely rebuild Tasmota with MCP and MQTT support based on latest code base... Thanks |
Beta Was this translation helpful? Give feedback.
-
Wow, that was quick, thanks for your answer.
Thanks for being patient and your explanations. Sadly it's very confusing with all the SetOptions, SwitchModes, ButtonTopics, mcp file and so on at same time for me. And another one: how to avoid a rest to defaults? I accidently reverted my config.... I have already
but after some power interrupts (as interrupting power via fuse was quicker than making a restart via console/WebUI), settings were lost and I was in AP mode... |
Beta Was this translation helpful? Give feedback.
-
thanks to sfromis the correct settings were found, working as expected and I'm totally happy |
Beta Was this translation helpful? Give feedback.
Yes, you can stop using
SwitchMode 16
, but instead useSetOption114
with a suitableSwitchMode
like 1 or 2.