Motion Not Detected Not Working with Alexa Skill

Hello Hubitat

I guess I don't use hubitat in the traditional sense. I run all my routines via Alexa, so hubitat and my motion sensors are only used as triggers to my Alexa routines. For a solid year this worked without issue! Completely satisfied ST refugee.

I'm having an issue where My Alexa routines are not being launched any longer by inactivity (motion not detected).

All motion sensors still work to initiate Alexa routines through the Alexa hubitat skill. I simply go in an enable the skill/ sensors and use them as triggers in Alexa routines (existing, new.. everything works if your using motion as a trigger).

It use to work where both Motion/ "No motion detected" would trigger routines. Now only motion based triggers launch routines.

For example: if I walk into my living room I have a routine that uses the hubitat related motion sensor as a trigger. It then turns on my living room lights.

I have another routine set to work where if no motion is detected in the living room for 5 minutes turn off the living room lights. This is not working..
none of my no motion routines are.. onlyy the routines where the trigger is based on motion work. I'm really in a bad spot as I have hundreds of routines in Alexa app and most of my routines were using Hubitat motion sensors (detected/not detected).

In the hubitat app I can see error messages in the logs for the hubitat Alexa skill related to the access token.

-06-15 09:49:11.856 am errorError making Call to Alexa message gateway: {"header":{"namespace":"System","name":"Exception","messageId":"8fce67cb-260c-4a37-9853-e38cac0fc6c2"},"payload":{"code":"INVALID_ACCESS_TOKEN_EXCEPTION","description":"Access token is not valid."}}

How does one access token become invalid? Or how do I get a valid token?

Also under the hubitat Alexa skill app under the application state it's says: new install = true
So I guess it's trying to start over fresh...

But it also says

getAlexaAccessToken 2021-06-15 10:45:13am EDT PENDING

^ this message repeats itself over and over again every couple of hours. It never changes from pending, it just keeps trying and never succeeds.

I'm assuming there is a bug somewhere in the skill, hubitat software where it's not working to issue the access tokens correctly.

Please respond back with assistance on how I can regain functionality!

Thanks!

Is this recapitulation of the problem you have run into accurate?

  1. Hubitat motion active events show up in the Alexa app and trigger routines.
  2. Hubitat motion inactive events also show in the Alexa app but do not trigger routines.

If your Alexa routines triggered by "motion active" are working fine, and only the routines triggered by "motion inactive" are not working, then the Hubitat errors you've indicated are a red herring, and the issue lies at the Alexa end.

Also tagging @bcopeland

1 Like

I think this is normal. Under application state, what is the value of "tokenExpires"?

Motion & inactivity shows up in hubitat under the logs so no problem there.

Only motion based activities show up in Alexa, the "motion not detected" activities do not show in Alexa ... But clearly shows working in hubitat.

The issue here:

getAlexaAccessToken 2021-06-15 10:45:13am EDT PENDING

It's always stuck on pending, it never shows "previous runtime" filled in. Once it gets to the set time in the getAlexaAccessToken it simply resets. And the goal post is kicked once again and the continuous loop goes on.

I don't think this is normal giving the error message I'm seeing in the hubitat app related to the Alexa skill

06-15 09:49:11.856 am errorError making Call to Alexa message gateway: {"header":{"namespace":"System","name":"Exception","messageId":"8fce67cb-260c-4a37-9853-e38cac0fc6c2"},"payload":{"code":"INVALID_ACCESS_TOKEN_EXCEPTION","description":"Access token is not valid."}}

It says it very clearly the token it's invalid and the only error message in my logs. So the access token that's pending appears to be invalid..

I don't understand the inner workings here but if someone from development can chime in and explain why the token isn't valid I think that might shine some light on what the inactivity/ not detected routines don't work.

I agree the problem appears to be more in the Alexa skill itself than in the hubitat software

This is normal.

What is the value of "tokenExpires"?

1 Like

If you reboot your Hubitat Hub, does the problem go away, at least temporarily? Rebooting the hub is one way to force the reestablishment of proper communications between Hubitat and Alexa. I am just curious if this has any effect on this issue you're experiencing or not?

2 Likes

I'm really confused by this. Are all your motion sensors perpetually in the "motion detected" state in Alexa? If they are not, then "motion inactive" events are definitely reaching Alexa.

1 Like

Here's the equivalent section of my Alexa Skill


:

The Alexa token is set to expire at 10:38 (tokenExpires converted to date/time). The pending job to renew the token is pending to run at 10:37.

1 Like

@joeswann.biz

I have confirmed that this is an issue at the Alexa end by doing the following:

  1. Created a virtual motion sensor that I shared with Alexa
  2. Created Alexa routines that are triggered by "motion detected", or "motion not detected"
  3. Changing the sensor on Hubitat to "active" changes its status on Alexa to "motion detected" and the routine runs.
  4. However, while setting the sensor to "inactive" on Hubitat changes its status on Alexa to "motion not detected", the routine does not run.

Since Hubitat is clearly sending an accurate status of the sensor to Alexa, the failure is at the Alexa end.

1 Like

The value of token expires is: 1623768373017

I tried rebooting as one of my first steps of troubleshooting, unfortunately it had no effect.

Attaching screenshots of what I meant when I said motion base activity shows up in Alexa. Where as "motion not detected" shows nothing.

I'm also attaching a screenshot that shows both motion and inactivity is detected and working within hubitat app

I think we're in agreement that the issue appears to be within Alexa. However my question are:

  1. is the problem the hubitat skill itself that needs to be updated - On Hubitats to do list?

  2. Issues with Alexa - Something Amazon needs to fix?

It worked for both motion and non motion for an entire year. Only recently have I noticed it's stopped working. I'm glad you were able to reproduce on your end and proves I'm not crazy!

My hope is that hubitat would chime and address this formally as I do think it's a minor bug that can be fixed fairly quickly with the right eyes on it.

I am curious for you aaiyar... Since you are able to reproduce. Are you also seeing an error message under logs, when you click on the Alexa skill

{"code":"INVALID_ACCESS_TOKEN_EXCEPTION","description":"Access token is not valid."}}

^ are you getting this error message too? I don't have any clue as to what this means/ is doing/ isn't doing. But if your getting the message too than it shows my problem isn't unique (well you already proved that)... But it shows that down to the error messages my problem isn't unique.

I've tried removing all sensors from Alexa, removing Alexa hubitat skill, removing routines... Adding all back from scratch and it has the same results. Only motion based routines run....

This. Hubitat is correctly reporting motion state to Alexa. Thatโ€™s the extent of their involvement. Alexa is apparently not using motion state as a trigger

1 Like

I just ran a quick test, using two different Iris v2 Motion/Temperature sensors. Both were able to Trigger Alexa Routines for Active and Inactive states.

Not saying the problem is not real... more that the problem seems to affect users differently, or not at all (as in my case.)

3 Likes

I think there's more to it though (than it being amazons fault) because hubitat shows the activities correctly. Why couldn't it be an issue with the hubitat Alexa skill? It's well known that hubitats amazon Alexa app (different than the skill) isn't recommended for a number of reasons. The Amazon Alexa skill is preferred

I just don't know how the hubitat skill isn't ruled out as the issue? It's clearly produces access token errors...

Because the state updates correctly at the Alexa end.

1 Like

Those happen sporadically when cloud isnโ€™t available. And token renews at the next attempt.

1 Like

I'm using 3 different type of motion sensors with hubitat.. I wish I knew the correlation why yours works and mine doesn't

Can you try going into your skills, removing the hubitat skill and then adding it back to see if your still have functionality? Specially th ine "no motion detected" routines.

Highly confusing at this point because it's working for you but not for me and Aayiar and it's not clear as to why ( i was almost happy we were all on the same page ....but atleast I'm not alone alone :joy:)

I tried a motion sensor (and some other sensors) the other day, and Alexa did not recognize motion at all. Either active or inactive. I think there is something very broken at Amazon.