Feature request - Toggle command for domoticz

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
jongerenchaos
Normal user
Posts: 11
Joined: 21 Jan 2016, 22:28

Feature request - Toggle command for domoticz

#1 Post by jongerenchaos » 18 Feb 2016, 19:37

Is there someone who can add the Toggle function (for example as checkbox for sensors and switches?) It is possible to use this option (describe on) http://www.esp8266.nu/forum/viewtopic.php?f=2&t=36 but this is very slow.If you can use this directly from the ESP from every input it is much faster than the option described on the previous topic (when you add it can you do it also for the supported input chips).

esp
New user
Posts: 1
Joined: 11 Mar 2016, 12:25

Re: Feature request - Toggle command for domoticz

#2 Post by esp » 11 Mar 2016, 12:40

If you mean Toggle for Domoticz try this but Im not sure, i did not make test, but you can try and share result.

in folder ESPEasy_R78\Source\ESPEasy file _C001.ino find:

Code: Select all

          case SENSOR_TYPE_SWITCH:
            url = F("/json.htm?type=command&param=switchlight&idx=");
            url += event->idx;
            url += F("&switchcmd=");
            if (UserVar[event->BaseVarIndex] == 0)
              url += "Off";
            else
              url += "On";
            break;
and change to:

Code: Select all

          case SENSOR_TYPE_SWITCH:
            url = F("/json.htm?type=command&param=switchlight&idx=");
            url += event->idx;
            url += F("&switchcmd=");
            if (UserVar[event->BaseVarIndex] == 0)
              url += "Toggle";
            else
              url += "Toggle";
            break;
next in folder ESPEasy_R78\Source\ESPEasy file _C002.ino find:

Code: Select all

          case SENSOR_TYPE_SWITCH:
            root["command"] = "switchlight";
            if (UserVar[event->BaseVarIndex] == 0)
              root["switchcmd"] = "Off";
            else
              root["switchcmd"] = "On";
            break;
change to:

Code: Select all

          case SENSOR_TYPE_SWITCH:
            root["command"] = "switchlight";
            if (UserVar[event->BaseVarIndex] == 0)
              root["switchcmd"] = "Toggle";
            else
              root["switchcmd"] = "Toggle";
            break;
If im not wrong , instead ON and OFF you will have Toggle

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest