Plugins _P009_MCP

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
smagghe
New user
Posts: 7
Joined: 01 Nov 2015, 23:28

Plugins _P009_MCP

#1 Post by smagghe » 02 Dec 2015, 23:56

Hello,

In this Christmas period, i use an ESPEasy with a MCP23017 to switch on/off all my christmas lights.
But with Domoticz, if i send 8 mcpgpio command in the same time, my little Esp :oops: be confused and then Bug :evil: .
So i've made a little addition to the MCP Plugin : the "mcpioall" command :

Code: Select all

 
        if (tmpString.equalsIgnoreCase("MCPIOALL"))
        {
          success = true;

          argIndex = string.lastIndexOf(',');
          tmpString = string.substring(argIndex + 1);
          char tmp[17];
          tmpString.toCharArray(tmp, 17);
          urlDecode(tmp);
          for (int p = 0; p < 16; p++) {
            if (printToWeb)
            {
              printWebString += F("MCPIOALL Port ");
              printWebString += p;
            }
            if (tmp[p] == '0' || tmp[p] == '1') {
              Plugin_009_Write(p, tmp[p]);
              if (printToWeb)
              {
                printWebString += F(" Set to ");
                printWebString += tmp[p];
                printWebString += F("<BR>");
              }
            } else {
              if (printToWeb)
              {
                printWebString += F(" Ignored ");
                printWebString += F("<BR>");
              }
            }
          }
        }

     
i use it as that :<ESP IP>/control?cmd=mcpioall,0,0,10100x001

where the last value be the setting for each port of the mcp23017. The result for this command is :

MCPIOALL Port 0 Set to 1
MCPIOALL Port 1 Set to 0
MCPIOALL Port 2 Set to 1
MCPIOALL Port 3 Set to 0
MCPIOALL Port 4 Set to 0
MCPIOALL Port 5 Ignored
MCPIOALL Port 6 Set to 0
MCPIOALL Port 7 Set to 0
MCPIOALL Port 8 Set to 1
MCPIOALL Port 9 Ignored
MCPIOALL Port 10 Ignored
MCPIOALL Port 11 Ignored
MCPIOALL Port 12 Ignored
MCPIOALL Port 13 Ignored
MCPIOALL Port 14 Ignored
MCPIOALL Port 15 Ignored

and that all !

Post Reply

Who is online

Users browsing this forum: No registered users and 79 guests