HTTP 409 error: Unable to delete record

Posted on
Wed Jun 16, 2021 11:12 am
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: HTTP 409 error: Unable to delete record

OK!

I'll give this method a shot!

And I'm also noticing that my incoming text is in the Custom State for my phone number, so I'm guessing I could also use Python to get this to work as well.

Posted on
Wed Jun 16, 2021 11:16 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTP 409 error: Unable to delete record

The second part of this is that when the plugin polls for new messages (either from a webhook action, or by a scheduled poll), then IF there are new messages, it will fire a trigger for any message that matches the criteria for that trigger. So best practice is for triggers to only fire if there's a relevant message. You can then use Conditions to further refine what actions to take. So the trigger could be based on the sending phone number (so only texts from your number do anything), and then a condition based on the text received to do different things.

Now the question is why do your action triggers never do anything? For that, I would need to see the trigger definition, and the debug (possibly detailed debugging) log from the plugin when the plugin polls the server.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 16, 2021 11:45 am
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: HTTP 409 error: Unable to delete record

Happy to send the log info:
Code: Select all
Schedule                        **Get Twilo (delayed action)
   Twilio Debug                    checkMessages: Message from +1504237xxxx, to: +1985222xxxx, direction: inbound, date_sent: '2021-06-16 17:13:06+00:00'
   Twilio Debug                    Checking Trigger Mail -Reset  TWILo verion 2584 (35271989), Type: patternMatch
   Twilio Debug                       Checking field messageFrom for pattern 'Mail' using simpleMatch
   Twilio Debug                       No simpleMatch Match for Trigger Mail -Reset  TWILo verion 2584 (35271989)
   Twilio Debug                    Checking Trigger T-2110 Twilio Home from phone 2584 (488734743), Type: messageReceived
   Twilio Debug                    checkMessages: Done


BUT

What I've done now is in the trigger that fires when the variable changes, is to write a tiny python script to check the Custom State, "messageText", and then execute the action. I've got this script running on a 5 second delay. What I like about this is that I can have just one trigger to do the Whole Show for me, and I can add more messages to check for different text all in the same script.. I need to add 'message from' to the script just to make sure no one else can send stuff, but the likelihood of that happening is about zero, but I think I can figure that part out too.

Code: Select all
Twilio = 142748732
TwilioState = indigo.devices[Twilio].states['messageText']


if TwilioState == "Mail":
      indigo.trigger.enable(1189209404, value=True) #reenable mail trigger


And I'd also add that my original triggers that check for certain text must obviously be setup wrong, as the python script above works perfectly.
Trigger Type: Twilio Event
Event: SMS Message Received
Event Settings: Twilio Phone Number

Condition:
if any of the following are true:
if device Twilio Phone Number Message To is equal to home (in this trigger, home is the trigger text)
Actions: Execute Action Group

Posted on
Wed Jun 16, 2021 11:51 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTP 409 error: Unable to delete record

OK, I really do not understand what you're doing.

What I've done now is in the trigger that fires when the variable changes, is to write a tiny python script to check the Custom State, "messageText", and then execute the action.


This is the trigger on the HTTPd-2 device that's received the webhook? The ONLY thing you should be doing with that trigger is calling the "Check for Messages" Twilio action. If you don't do that, then Twilio doesn't think that messages has ever been received, and it's still sitting in the queue to be delivered.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 16, 2021 11:55 am
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTP 409 error: Unable to delete record

Oh, wait. I misunderstood what you wrote. I think.

In your Python script, you really don't want to be enabling/disabling triggers. You already have a working trigger (the one that's executing the script). I think you want to be executing an action group there.

But really, I think using a Pythons script here is probably overkill, and you really need to get normal triggers working before you get into advanced processing. ;)

I can't tell from what you wrote how you configured the triggers that didn't work. I think I need screen shots or something to see what you did. Plus an example of the actual text you're sending that's supposed to activate the trigger.

And use the Twilio event matching, not conditions.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 16, 2021 12:12 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: HTTP 409 error: Unable to delete record

Actually, I'm back on my original method. So the trigger that checks for the variable change AND now also checks for certain incoming text, and acts accordingly. In the example I sent, it does just want I want to, which is to re-enable a trigger that has been dis-abled. Some other incoming text will fire off action groups, or whatever is needed. So here is a pic of that original, and now, my only trigger. I can easily edit the python script to do different stuff as different text comes in. Still not sure why I can't get the triggers to fire from the GUI, so am adding screen shots of those as well. (Sorry I can't get the pics in the right order......)
Attachments
Screen Shot 2021-06-16 at 1.08.24 PM.png
Screen Shot 2021-06-16 at 1.08.24 PM.png (358.14 KiB) Viewed 8644 times
Screen Shot 2021-06-16 at 1.04.44 PM.png
Screen Shot 2021-06-16 at 1.04.44 PM.png (228.17 KiB) Viewed 8644 times
Screen Shot 2021-06-16 at 1.08.09 PM.png
Screen Shot 2021-06-16 at 1.08.09 PM.png (415.41 KiB) Viewed 8644 times
Screen Shot 2021-06-16 at 1.08.24 PM.png
Screen Shot 2021-06-16 at 1.08.24 PM.png (358.14 KiB) Viewed 8644 times

Posted on
Wed Jun 16, 2021 1:17 pm
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTP 409 error: Unable to delete record

jltnol wrote:
So the trigger that checks for the variable change AND now also checks for certain incoming text, and acts accordingly.


First, let's get the terminology straight. Are you actually using the "twilio_ping" variable to activate the ** Get Twilio trigger, or are you using the alternative method I described earlier. You don't show the trigger pane for that trigger, just the actions pane. If you're using the variable, that's OK, I just need to be sure of what method you're using. In any case, you don't need a delay on resetting the variable. If you're not using the variable, get rid of that action totally.

And you should NOT be running any python script in that action group. The ONLY thing that's safe to do here is run the "Check for Messages" Twilio action.

Now, the third image is the actual trigger. You've specified the trigger to run when the string "Mail" is included in the Message From field. Which is never going to happen because Message From is the originating phone number. You probably want that to be Message Text .

And let me make sure I understand these actions. Your intent is to enable to disable some other trigger (named "Mail") that will be activated by some other mechanism? And that's it?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 16, 2021 2:20 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: HTTP 409 error: Unable to delete record

First, let's get the terminology straight. Are you actually using the "twilio_ping" variable to activate the ** Get Twilio trigger, or are you using the alternative method I described earlier

Didn't mean to be confusing, but the former, PING method.

You've specified the trigger to run when the string "Mail" is included in the Message From field. Which is never going to happen because Message From is the originating phone number. You probably want that to be Message Text

So this was my problem in evaluating incoming message text... I had it set incorrectly. That is now working as designed.

And let me make sure I understand these actions. Your intent is to enable to disable some other trigger (named "Mail") that will be activated by some other mechanism? And that's it?


I think just the opposite..... I have a sensor in the mailbox that sends me a text message when I have mail. Once it triggers, it automatically disables itself, so when I actually open the mailbox to get the mail, it doesn't send me another text message. While it does automatically re-enanble itself after a long period of time, there are instances when I need to manually re-enable it, and that is were sending the word MAIL as a text message comes in. My problem was my " re-enable trigger when the text 'MAIL' is received" didn't work, because I had it set up incorrectly. Now that its working, I can take out my python script from the trigger that looks for the twilio_ping change, leaving just the Get Messages and the Re-set Variable action, which is I'm sure what you had intended.

So thanks for your time and help. Everything is working thru the GUI just as you have designed it.

Posted on
Wed Jun 16, 2021 2:24 pm
FlyingDiver offline
User avatar
Posts: 7190
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HTTP 409 error: Unable to delete record

OK, good to know it's working right now.

What sensor are you using in the mailbox? I could never find one I thought would work. So now I'm using a Camect NVR with image recognition to identify the USPS truck stopping at my mailbox. ;)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jun 16, 2021 5:04 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: HTTP 409 error: Unable to delete record

Nothing quite as fancy as yours. Basically its a Z-Wave Door/Window Security sensor. My mailbox is out on the street, but close enough for reliable communication on Z-Wave. Indigo has it listed as a IM20. I can track down exactly what it is if you like.

Thanks again for your help.

Who is online

Users browsing this forum: No registered users and 2 guests