Announcement

Collapse
No announcement yet.

Serial callback doesn't work on simultaneous event triggers?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Serial callback doesn't work on simultaneous event triggers?

    Hello all,

    I've implemented a script that communicates with a Cyclades PM10A, which is a power strip you communicate with over a 9600baud link to tell it to turn outlets on and off, ask for status, etc.

    My script refreshes the PM10A's status once every 3 minutes. Basically, I send a "status all" with a carriage return to make sure all 10 of the outlets are in the correct state, and look for the PM10A's "pm" prompt in the response so I can know the link is healthy.

    If I don't see one prompt at least once every 4 minutes, I send another carriage return and also send myself an email to say that the watchdog timed out.

    It seems like my script works very well. However, maybe once a day or so, where the watchdog times out, and sends the second carriage return. On this timeout, the serial callback is finally called. The output of "hs.GetComPortData" in the callback indicates that two prompts have been received.

    The only pattern that I can detect is that every time the callback fails to be called, there was another event that was triggered in the same second:

    10/22/2012 2:14:09 PM Event Event Trigger "Refresh PM10 Login"
    10/22/2012 2:14:09 PM Event Running script in background: PM10Handler.txt("SendToServerPM10","RefreshLogin")
    10/22/2012 2:14:09 PM Event Event Trigger "Update Audrey Page"
    10/22/2012 2:14:09 PM Event Running script in background: MyScripts.txt("UpdateAudreyPage","")
    10/22/2012 2:14:09 PM LogPM10Cmd SrvPM10 RefreshLogin
    [...]
    10/22/2012 2:15:09 PM Event Event Trigger "SrvPM10 Watchdog Timeout (delayed event)"
    10/22/2012 2:15:09 PM Event Event Trigger "SrvPM10 Watchdog Timeout"
    10/22/2012 2:15:09 PM Event Running script in background: PM10Handler.txt("SendToServerPM10","Watchdog")
    10/22/2012 2:15:09 PM LogPM10Cmd SrvPM10 Watchdog!!
    10/22/2012 2:15:09 PM SrvPM10 SrvPM10:InputReceived: statusallONSI(s)Users1UOFF2UON3UON4UOFF5UOFF6UOFF7UOFF8UON9U ON10UONpmpm
    10/22/2012 2:15:09 PM email Email successfully sent
    10/22/2012 2:15:09 PM SrvPM10 SrvPM10: Prompt seen. Normal state.

    Has anyone seen anything like this?

    Thanks,
    Chris

    #2
    I didn't figure out what the problem was, but I did figure out how to work around it.

    What I ended up doing is switching the recurring PM10 polling from calling a script to toggling the state of a device, which in turn causes a script to be run.

    Not sure what the difference is, but I haven't seen any problems with the serial callback since I switched a couple days ago.

    Chris

    Comment


      #3
      Good info, Chris. I got my PM10 but am trying to figure out how to mount it in my wiring closet. Do you have yours in a rack?
      HS4Pro on a Raspberry Pi4
      54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
      Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

      HSTouch Clients: 1 Android

      Comment


        #4
        As you can see from the picture, I don't really have a problem with figuring out how to mount a 19" piece of gear.

        With that said, however, I'm likely not going to be installing it in one of the racks. I have a 19" bracket hanging from one of the rafters behind this gear that I'll be installing it in, to make it closer to the power panel on the wall. The power panel is where most of the modules-to-be-replaced are.

        I think my script is stable now. It took a few iterations, but I think the race conditions, queuing issues, and kinks in the watchdog timer have been resolved. It's not necessarily the most elegant (I only have a dozen or so hours invested in it), but I could post it somewhere. I looked into writing a plug-in, but decided against it. I use mcsMovement as a front-end to the ten outlet devices that I created for HS to interact with, but I'm sure the script could easily be tweaked to register for device notifications directly. I guess it might even cut down the overhead a smidge, so maybe I should do that anyway.

        Chris
        Attached Files

        Comment


          #5
          Wow, Chris - that is impressive! I would be embarassed to post a pic of my wiring closet
          HS4Pro on a Raspberry Pi4
          54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
          Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

          HSTouch Clients: 1 Android

          Comment


            #6
            Chris is up on the international space station, can't you tell from all the stuff??

            Besides, 3Com AUDREY!!!

            --Dan
            Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

            Comment


              #7
              Ha, actually, what's not shown here is the NASA supercomputer. It told me when I powered it up that it came from Goddard, from the Laboratory for Hydrospheric Processes. :-) So, not quite the space station, but still from Space.

              (And yep, I haven't yet had an Audrey fail me altogether. I've had to reflash once or twice, but no hardware failures, and I have like a dozen of them deployed.)

              Chris

              Comment

              Working...
              X