Announcement

Collapse
No announcement yet.

Trying to create script to run after condition device state unknown

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

    Trying to create script to run after condition device state unknown

    I have an event which sens me a message when a specific device goes into status unknown. That event then turns my zwave PI off then on again. What I would like to do is the following though, as sometimes it does not need restarting. Sometimes sending a command changes the device to that state, and is no longer status unknown.

    If the device changes to status unknown, send a off command, wait a few seconds, send a on command. If after 30 seconds the status is still unknown, run another event (which is Jon00's plugin disable/enable)

    I think I need a script to do that. I can trigger the script with a trigger 'when device changes to status unknown' but not sure how to go from there

    #2
    So, make a copy of your current event and change the copy to send off the command instead of sending you a message.
    Take your original message sending event and change the trigger to where the trigger is if the device status is "unknown" for at least 30 seconds.

    Comment


      #3
      Originally posted by mikee123 View Post
      I have an event which sens me a message when a specific device goes into status unknown.
      Out of curiosity, how do you do that? I have looked at devices in the "Unknown" state before, and neither the status nor the text string shows anything about Unknown. Here's a test switch that is currently "Unknown" as it is disconnected, so all commands to it fail, but looking at the Advanced tab, nothing indicates that:

      Click image for larger version

Name:	Capture.PNG
Views:	101
Size:	63.8 KB
ID:	1273499
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        It comes up as a trigger, see below. I did a few test events like that, and it seems to work
        Attached Files

        Comment


          #5
          Originally posted by mikee123 View Post
          It comes up as a trigger, see below. I did a few test events like that, and it seems to work
          Thanks!
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            Originally posted by joegr View Post
            So, make a copy of your current event and change the copy to send off the command instead of sending you a message.
            Take your original message sending event and change the trigger to where the trigger is if the device status is "unknown" for at least 30 seconds.
            If I did that, it would trigger a message after the state is unknown 31 seconds. Then trigger the second event, sent a command to turn on/off. But the original event would keep triggering if the state stays unknown, as its still over 30 seconds so it'll go into a loop or am I wrong ?

            Comment


              #7
              You can set the first event that triggers (to send a command) to not repeat for x minutes to resolve that.

              My Insteon devices have an unknown status that is simply one of the device statuses just like on, off, and dim.

              Comment


                #8
                That would still mean I get a notification every x minutes which I would like to avoid...

                Comment


                  #9
                  Originally posted by mikee123 View Post
                  That would still mean I get a notification every x minutes which I would like to avoid...
                  Sorry, I thought the issue would be corrected after the first time the event fires. I guess I don't understand what you are trying to do.

                  Comment


                    #10
                    The issue might get corrected after sending a on or off command. Most likely it wont though. If it doesnt, I'll want to restart the zwave PI via another event. That sometimes help getting the network running again.

                    Comment


                      #11
                      I guess that I am not explaining it clearly.

                      Event 1: trigger when device go to status unknown. Send on or off command or whatever sometimes helps. Set so that it triggers when the device changes from something to unknown. That way it won't trigger again. Otherwise, use the can't retrigger or x minutes.

                      Event 2: trigger when the device has been status unknown for at least 30 seconds. Do the action to turn the plugin off and back on. If this does not always fix it, then set to to not retrigger for Y minutes.

                      Event 3: trigger when the device has been status unknown for at least 1 minute. Send yourself a message that it couldn't be corrected. Set it to not retrigger for Z hours.



                      Device becomes unknown - event 1 triggers. This fixes it, so events 2 and 3 never trigger, nor does event 1 again.

                      Device becomes unknown - event 1 triggers. This does not correct it, so 30 seconds later event 2 triggers. This fixes it, so event 3 never triggers, and events 1 and 2 don't retrigger.

                      Device becomes unknown - event 1 triggers. This does not correct it, so 30 seconds later event 2 triggers. This does not fix it, so 30 seconds later event 3 triggers and warns you. Events 1 and 2 retrigger every x and y minutes (unless event one is set as a change trigger, then it never retriggers). You get a warning every Z hours until you resolve it.

                      Comment


                        #12
                        I think that could work. Most of the time, after restarting the PI, the status of the device stays as unknown until the next command has been sent. But I can incorporate action to send a on or off which should clear the status, and 'rearm' the series of events. Its just to decide what to send, on or off. Ideally I would want to find what the last command was... maybe I can use logmon for that. I'll have a think. In the meantime, I'll give the event combo a try.

                        Comment


                          #13
                          Have you tried polling the device after it goes unknown or after the plugin restart?

                          Comment


                            #14
                            No, but thats worth trying. If it works, the last command would probably be the opposite to what it shows after polling as it did not get that command. Unless its gone unknown without anything been sent.

                            Comment


                              #15
                              Another scenario is that they actually change, but the confirmation packet does not make it back to HS, so HS marks it as Unknown. Polling should show the right state if the node responds in that case. You may need to use a virtual device to keep track of what state you expect it to be in and then compare against it.
                              HS 4.2.8.0: 2134 Devices 1252 Events
                              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                              Comment

                              Working...
                              X