Updated MCP23008 MCP23017 (markdown)

andrethomas 2018-08-01 20:05:07 +02:00
parent e7828e9197
commit e5ce33f533
1 changed files with 28 additions and 3 deletions

@ -52,8 +52,7 @@ There is a single command that may be used for resetting all pins to INPUT with
This will be confirmed by a response like this - note the 99's indicated in each value to differentiate it from other MQTT responses
`MQT: stat/sonoff/RESULT = {"Sensor29":{"D":99,"MODE":99,"PULL-UP":99}}`
`MQT: stat/sonoff/RESULT = {"Sensor29":{"D":99,"MODE":99,"PULL-UP":99,"STATE":99}}`
You may also query the existing configuration for a particular pin using
@ -65,10 +64,12 @@ For example:
Will report as follows:
`MQT: stat/sonoff/RESULT = {"Sensor29":{"D":0,"MODE":1,"PULL-UP":0}}`
`MQT: stat/sonoff/RESULT = {"Sensor29":{"D":0,"MODE":1,"PULL-UP":0,"STATE":0}}`
Confirming that the pin is in pinmode 1 and that the pull-up resistor is not enabled.
The current STATE of the pin 0(LOW) or 1(HIGH) as at the time the command is issued is also reported.
The format for sending configuration messages for individual pins via serial, web console or MQTT messages are as follows:
`sensor29 pin,pinmode,pullup`
@ -139,4 +140,28 @@ Interrupt message on LOW for input pin 1
19:28:57 MQT: stat/sonoff/RESULT = {"Time":"2018-07-29T19:28:57","MCP230XX_INT":{"D1":0}}
```
In addition to the MQTT message the driver will also execute an event command in the following format:
`event MCPINTDxx=y`
Where xx = the pin number from 0 through 7 (MCP23008) or 0 through 15 (MCP23017) and y the state of the pin as it was captured by the interrupt register of the MCP23008/MCP23017 chip.
The complete output for an interrupt enabled pin would look like this:
```
MQT: stat/sonoff/RESULT = {"Time":"2018-08-01T17:53:34","MCP230XX_INT":{"D0":0}}
SRC: Rule
RSL: Group 0, Index 1, Command EVENT, Data MCPINTD0=0
MQT: stat/sonoff/RESULT = {"Event":"Done"}
```
The latter makes it possible to integrate interrupt responses with rules for example:
```
rule on event#MCPINTD0=1 do power on endon on event#MCPINTD0=0 do power off endon
```
In the example above the rule would respond to an interrupt of HIGH on pin 0 of the MCP by executing command "power on" and respond to an interrupt of LOW on pin 0 with the command "power off"
See the Wiki on [Using Rules](https://github.com/arendst/Sonoff-Tasmota/wiki/Rules) for more information on how this can be helpful to your requirements.
_Finally, keep in mind that the MCP23008/MCP23017 chip will only store the last interrupt registered in the interrupt register and capture register - Because the interrupt register is only checked every 50 milliseconds by the Tasmota firmware you may experience missed interrupts if your incoming signals fluctuate/change faster than 20 times per second._