Announcement

Collapse
No announcement yet.

Strange Error

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strange Error

    I've started to get this strange error in my scripts. The error is as follows:

    6/1/2005 8:25:23 PM~!~Error~!~Script error in file: GarageMotionDetector.txt: -2147417843: in line 13

    When HomeSeer is in the mood, many scripts start generating this error, and all the errors have in common that they are flagging in a script with a line with a test of zone status, like the one below:

    if hs.IsOnByName("System Status Inside Darkness") OR hs.plugin("HAI_System").ZoneStatus(21) = "Secure" AND hs.plugin("HAI_System").ZoneStatus(22) = "Secure" then

    In each case, the error is always -2147417843

    I'm running HAI plugin 1.0.66

    Any ideas?

    #2
    Anogee,

    This is an ActiveX automation error, the specific meaning is:
    Code:
    The run-time error occurs because you are trying to make an Automation call to an out-of-process (ActiveX) EXE from within the event notification of the (software module). The value -2147417843 translates to the following error message: 
    An outgoing call cannot be made since the application is dispatching an input-synchronous call. 
    Automation clients are required by COM to process input-synchronous calls without interruption, and therefore are prevented from making outgoing Automation calls while processing such messages.
    In essence, the ActiveX class (hspi_HAI.exe) has either terminated or is busy and locked out. This is a COM (ActiveX) error.

    This could just be due to limitations of COM and the way you have coded the statement in the script. Microsoft recommends for this error to use a timer and make your call later - my, what a stellar recommendation that is!

    Here is what I suggest you try:
    1. Break the big IF statement into three parts - e.g.:
    Code:
    IF hs.plugin("HAI_System").ZoneStatus(21) = "Secure" then b21 = True
    Then you would construct a statement to test that looks like this:
    Code:
    IF bIsOn OR (b21 AND b22) THEN ...
    2. If that does not work, then consider using error trapping to catch the big negative number error, and either repeat the command (but not forever - just one or two times so you do not lock up your script) or if the script is one that runs frequently, end the script and wait for the next running. In VBScript you can use these statements to control script flow and error handling:

    Code:
    On Error Resume Next
    Err.Clear
    (command here that might generate an error)
    If Err.Number <> 0 Then
         ' Error handler here
        Err.Clear
    End If
    On Error Goto 0      ' Reset error handler to terminate upon error.
    Regards,

    Rick Tinker (a.k.a. "Tink")

    Comment


      #3
      Anogee,

      I am getting the picture that the bulk of your automation system is script based instead of using events with triggers and actions - is that true? If so, can I inquire as to why? That last error could also be due to the COM registry being really messed up due to your switching versions back and forth, and you may need a good COM exorcism to take care of it. It may also be due to just too many things hitting up the ActiveX objects at once due to the script execution, but I am leery of that being the issue since HS runs things in a single thread (in 1.7). I am going to set up a test here that runs a script frequently and checks zone status to see if I can reproduce the error, but I am running 1.2 under HS 2.0 so it will be a different environment.

      If you are not familiar with how to remove ActiveX server artifacts/registrations from your registry and you have some sort of remote access capability to your HS system, drop me an email and perhaps I can perform the exorcism for you and that might even get 1.2 working for you.
      Regards,

      Rick Tinker (a.k.a. "Tink")

      Comment


        #4
        O.K. I'm ready for a good ActiveX COM exorcism.

        I am getting the picture that the bulk of your automation system is script based instead of using events with triggers and actions - is that true?
        I guess that really depends upon your definition. I'm not sure I really do anything strange. I typically use an event trigger to launch a script, then a script handles it from there. Many of my scripts can be run from multiple triggers, so the script needs to do a fair bit of checking to find out the current state of things before it acts.

        I also design my scripts to just run and complete and not hang around and wait for an event. This means at any one time, its not very likely that any scripts are running. Overall I think my program structure is pretty good, in that if there is a problem, I know which trigger and which script the problem is likely in.

        I'll write to you, and maybe I can get this cleaned up.

        Thanks.

        Comment


          #5
          By "strange" I meant that most of your determination of when to do something is done in the script as well as having it carry out actions. In my system, I use the event trigger and conditions for everything - scripts are not used very often at all, and never to determine the status of a zone or anything like that.

          When somebody wants to do something where the order is very specific, I have seen them use scripts since they give you that power/flexibility, but normally I have seen it launched from an event that evaluates the triggers and checks conditions. It seemed strange to have a trigger launch a script, then have the script check conditions, and then carry out the actions too.

          If you were not aware, in HomeSeer 2, the actions are completely different for events. You can have as many of a particular action as you want in the event, and you can specify the order that they execute, so you can even have an event that does: device action, HAI action, run script, device action, HAI action, other action, device action.... which is impossible today without using a script. Good stuff.
          Regards,

          Rick Tinker (a.k.a. "Tink")

          Comment


            #6
            Mine's mostly script based as well as you can't use "by condition" as it only checks for all these conditions every minute.

            So there is no use using this in "If Zone X = not ready and Zonre Y = secure then something" as it'll never be right.

            You are forced to do all the extra checking in a script. If only by condition would go and query the device directly, rather than using 1 minute old "cached" values.

            Ross.

            Comment


              #7
              Ross,

              That is only when a condition is used AS a trigger.

              If the event triggers by an HAI Zone Trigger, and then has conditions applied to it, it functions just as you would expect it to - triggers immediately upon the zone changing.
              Regards,

              Rick Tinker (a.k.a. "Tink")

              Comment


                #8
                Same error polling thermostat plugin v 1.0.66

                Anogee,

                I am getting same error and there is a thread on it relating to thermostats running from Omni Pro (I have an Omni Pro II).

                This is how I fixed one (found this fix here) - but to me it was a patch and I would prefer to do what Rich states - only with a bit more detail.

                This is kind of kludgy but it works:

                OldValue21 = hs.DeviceString("w21")
                Value4 = cstr(hai.HAI_WhatIsTemp(1))
                If StrComp(OldValue, Value4) <> 0 And StrComp(Value4, "-2147417843") <> 0 And StrComp(Value4, "9999.99") <> 0 Then
                hs.SetDeviceString "w21",Value4,TRUE
                End If

                Rich, to fix this would I:

                On Error Resume Next
                Err.Clear
                value4 = cstr(hai.HAI_WhatIsTemp(1))
                hs.SetDeviceString "w21",value4,TRUE
                If Err.Number <> 0 Then
                Err.Clear
                End If
                On Error Goto 0 ' Reset error handler to terminate upon error.

                This is really the only script I am currently running that polls HAI status. The script polls thermostat, one remote temperature/humidity and one remote temperature.
                - Pete

                Auto mator
                Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                Comment


                  #9
                  Originally posted by Rick Tinker
                  Ross,

                  That is only when a condition is used AS a trigger.

                  If the event triggers by an HAI Zone Trigger, and then has conditions applied to it, it functions just as you would expect it to - triggers immediately upon the zone changing.
                  Rick,

                  You know, in all the time I've used Homeseer, I've never seen that "apply condition button" DOH! Thanks..

                  Comment


                    #10
                    Rick:

                    I'm amazed that you don't use many scripts. I guess that shows you that you can do much with just HomeSeer as it is.

                    I often find that I get stuck when I try that approach as there are many simply things you can't do that way. For example, you can't simply issue an X-10 command, do a status request, and verify it was sent correctly, then repeat if needed. I think that ability should be in HomeSeer.

                    I have about 130 events and 90 scripts. About 75% of my events have one and only one script they run. I name the script with the same name as the event, and I sometimes use conditionals. This gives me lots of flexibility and it is pretty organized.

                    For example, when I open the front door (zone goes not ready) I run a front door script. Everything associated with the front door is right there. I say the door is open, but only if someone is not in bed; I turn on the outside lights, but only if its dark; I keep track of my direction of motion to determine if Im getting a package, or receiving the one left for me. If my alarm is on, and its dark inside, I turn on the entry light.

                    If I used the event method, each of these actions would require at least one event, maybe more, and I'd have no control over the order of execution of all the events triggered by the same action (door opening). I don't think HS2 will even let you specify this order.

                    I have my events categorized by type of trigger (zone based, time based, temp based, repeating, etc.) so when something is wrong, I can find the problem easy. If I put everything in an event, I'd have 1000's of events, and it seems like maintenance would be harder.

                    I'm not sure if HS2 flexibility will let me to change this architecture. Its not so much the order in an event thats a problem, its the fact that you can't do multiple if-then's thats a bigger problem.

                    By the way, I installed HAI 1.2 and it seems to be working. I never did a full registry exorcism, because I didn't want to delete the wrong things, and there are MANY different hspi_HAI entries. I ran a registry cleaner-uper instead. (Have XP Home, so remote access is not possible.)

                    Anyway, I have my fingers crossed.

                    Comment

                    Working...
                    X