Send group command from Python?

Posted on
Sun Jun 22, 2008 2:43 pm
gabbas offline
Posts: 39
Joined: Jun 22, 2008

Send group command from Python?

Hi everyone, my first post here. I want to do some Python/Indigo hacking and I have a question please... is it possible to make Indigo send Insteon group commands using Python+XML? (Like you can from AppleScript with "send insteon group instnTurnOn using name "foo""?) I looked through the Database methods in IndigoWebServer/indigopy/indigodb.py, but didn't see anything that exactly fit the bill. There's GroupExecute but I'd prefer not to have to make several action groups for each Insteon group. Any suggestions?

Thanks in advance,
-Greg.

Posted on
Sun Jun 22, 2008 8:06 pm
bschollnick2 offline
Posts: 1355
Joined: Oct 17, 2004
Location: Rochester, Ny

Re: Send group command from Python?

gabbas wrote:
Hi everyone, my first post here. I want to do some Python/Indigo hacking and I have a question please... is it possible to make Indigo send Insteon group commands using Python+XML? (Like you can from AppleScript with "send insteon group instnTurnOn using name "foo""?) I looked through the Database methods in IndigoWebServer/indigopy/indigodb.py, but didn't see anything that exactly fit the bill. There's GroupExecute but I'd prefer not to have to make several action groups for each Insteon group. Any suggestions?


I will have to check. Matt sent me the API, and I do recall there being support for it, but I don't remember if it was included in the pythondb code...

I have a enhanced version that should work out of the box, but as I mentioned, I'll have to check if the Group commands are included...

Posted on
Mon Jun 23, 2008 2:53 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Send group command from Python?

Hi Greg,

I just added it to indigodb.py for you. It will be included in the next release. In the mean time you can copy/paste it into your version of indigodb.py:
Code: Select all
   def InsteonGroupOnCommand(self, indigoConn, groupNum, doFast, requestOrigin = None):
      if not self._allowControlPages:
         raise ControlDisabled
      indigoConn.CheckConnection()

      logStr = "request to send insteon group \"" + groupNum + "\" on command"
      if requestOrigin:
         logStr += " from " + requestOrigin
      self._Log(logStr)

      dataNode = ic.XmlNode()
      dataNode.AddStringNode(u"GroupNumber", groupNum)
      if doFast:
         dataNode.AddStringNode(u"GroupAction", u"1")
      else:
         dataNode.AddStringNode(u"GroupAction", u"0")
      indigoConn._SendPacket(ic.Packet(ic._kCommandType, u"InsteonGroupCommand", packetDataNode=dataNode))

   def InsteonGroupOffCommand(self, indigoConn, groupNum, doFast, requestOrigin = None):
      if not self._allowControlPages:
         raise ControlDisabled
      indigoConn.CheckConnection()

      logStr = "request to send insteon group \"" + groupNum + "\" off command"
      if requestOrigin:
         logStr += " from " + requestOrigin
      self._Log(logStr)

      dataNode = ic.XmlNode()
      dataNode.AddStringNode(u"GroupNumber", groupNum)
      if doFast:
         dataNode.AddStringNode(u"GroupAction", u"3")
      else:
         dataNode.AddStringNode(u"GroupAction", u"2")
      indigoConn._SendPacket(ic.Packet(ic._kCommandType, u"InsteonGroupCommand", packetDataNode=dataNode))

Regards,
Matt

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests