csuermann / virtual-smart-home

Virtual Smart Home Skill for Amazon Alexa and Node-RED
27 stars 18 forks source link

Issues after being down for a couple months. #27

Open turbo2ltr opened 3 days ago

turbo2ltr commented 3 days ago

I'm running version 2.0.3 in a node red docker container with my own AWS back end and everything was working fine when I moved. I'm set up in the new house and I'm trying to figure out why alexa commands to virtual devices are not working. In NodeRed, I get "user not found! Is VSH skill enabled?" next to virtual devices. I went checked everything and not seeing any issues.

The virtual devices show up in my alexa app, but says "server is unresponsive".

In the VSH AWS IoT thing I'm seeing Connected, Subscribed, Shadow Updated, Disconnect messages when I restart the flow. But no further messages appear. If I refresh the token in the connection setup in NodeRed, it seems to update just fine. All my registered devices are there.

I went through my VSH Skill settings in the Developer console and all seems fine.

So I'm really confused why it stopped working or exactly what "user" it is talking about. Essentially I unplugged it from one house and plugged it into another, but clearly something broke.

Also I'm unclear what this "momento" thing is that is required. I don't recall ever doing that.

Really don't have the time to do a full node red upgrade required to run the latest version of VSH. The rabbit hole is already way deeper than I was prepared for for today.

turbo2ltr commented 3 days ago

Just some additional info. I tested the skill using the test tab in the alexa console and it failed with "Endpoint unreachable" The Default and North American endpoint I have int he skill is: arn:aws:lambda:us-east-1:XXXXXXXXXX:function:virtual-smart-home-dev-skill This is the same ARN displayed in AWS ->Lambda -> Functions ->virtual-smart-home-dev-skill

I downloaded the SAM for that function In there, it is pointing to IOT endpoint a2XXXXXXXXy-ats.iot.us-east-1.amazonaws.com This is the same endpoint returned when I run the CLI command aws iot describe-endpoint --endpoint-type iot:Data-ATS

The alexa client ID and Secret are the same as in the "Permissions" tab of the Alexa skill.

I just don't know where the breakdown is.

turbo2ltr commented 3 days ago

So I took the plunge and updated everything. Now it doesn't work at all. lol.

30 Jun 19:03:08 - [info] [vsh-connection:{My amazon email address}] MQTT: attempting connection: XXXXXXX-ats.iot.us-east-1.amazonaws.com:8883 (clientId: vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX)
30 Jun 19:03:08 - [info] [vsh-connection:{My amazon email address}] MQTT: connected to XXXXXXXX-ats.iot.us-east-1.amazonaws.com:8883, connection #1
30 Jun 19:03:08 - [info] [vsh-connection:{My amazon email address}] MQTT: subscribe to topics: ["$aws/things/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/shadow/get/accepted","vsh/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/+/directive","vsh/service","vsh/version/4.4.1/+","vsh/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/service"]
30 Jun 19:03:08 - [info] [vsh-connection:{My amazon email address}] MQTT: publish to topic $aws/things/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/shadow/update: {"state":{"reported":{"connected":true,"vsh_version":"4.4.1","nr_version":"4.0.1"}}}
30 Jun 19:03:09 - [info] [vsh-connection:{My amazon email address}] MQTT: publish to topic vsh/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/changeReport: {"template":"GARAGE_DOOR_OPENER","endpointId":"vshd-XXXXXXXXX","properties":[{"namespace":"Alexa.ModeController","name":"mode","value":"Position.Down","instance":"GarageDoor.Position","changed":true}],"correlationToken":"","causeType":"PHYSICAL_INTERACTION","vshVersion":"4.4.1","userIdToken":""}
30 Jun 19:03:09 - [info] [vsh-connection:{My amazon email address}] MQTT: publish to topic vsh/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/changeReport: {"template":"TEMPERATURE_SENSOR","endpointId":"vshd-XXXXXXXXX","properties":[{"namespace":"Alexa.TemperatureSensor","name":"temperature","value":{"value":79.4,"scale":"FAHRENHEIT"},"changed":true}],"correlationToken":"","causeType":"PHYSICAL_INTERACTION","vshVersion":"4.4.1","userIdToken":""}
30 Jun 19:03:09 - [info] [vsh-connection:{My amazon email address}] MQTT: publish to topic vsh/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/changeReport: {"template":"TEMPERATURE_SENSOR","endpointId":"vshd-XXXXXXXXX","properties":[{"namespace":"Alexa.TemperatureSensor","name":"temperature","value":{"value":77,"scale":"FAHRENHEIT"},"changed":true}],"correlationToken":"","causeType":"PHYSICAL_INTERACTION","vshVersion":"4.4.1","userIdToken":""}
30 Jun 19:03:09 - [info] [vsh-connection:{My amazon email address}] MQTT: publish to topic vsh/vsht-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/changeReport: {"template":"TEMPERATURE_SENSOR","endpointId":"vshd-XXXXXXXXX","properties":[{"namespace":"Alexa.TemperatureSensor","name":"temperature","value":{"value":78.6,"scale":"FAHRENHEIT"},"changed":true}],"correlationToken":"","causeType":"PHYSICAL_INTERACTION","vshVersion":"4.4.1","userIdToken":""}
30 Jun 18:59:44 - [info] [vsh-connection:{my amazon email address}] MQTT: publish to topic vsh/vsht-ff9aed9e-XXXX-XXXX-XXXX-XXXXXXXX/requestConfig: {"vshVersion":"4.4.1"}
30 Jun 18:59:45 - [info] [vsh-connection:{my amazon email address}] MQTT: message received on topic vsh/vsht-ff9aed9e-XXXX-XXXX-XXXX-XXXXXXX/service: {"operation":"kill","reason":"User not found! VSH Alexa skill enabled?"}
30 Jun 18:59:45 - [red] Uncaught Exception:
30 Jun 18:59:45 - [error] TypeError: this[logLevel] is not a function
    at ConnectionNode.logger (/data/node_modules/node-red-contrib-virtual-smart-home/connection.js:70:27)
    at ConnectionNode.handleKill (/data/node_modules/node-red-contrib-virtual-smart-home/connection.js:610:12)
    at ConnectionNode.handleService (/data/node_modules/node-red-contrib-virtual-smart-home/connection.js:644:16)
    at MqttClient.<anonymous> (/data/node_modules/node-red-contrib-virtual-smart-home/connection.js:823:18)
    at MqttClient.emit (node:events:519:28)
    at MqttClient.<anonymous> (/data/node_modules/node-red-contrib-virtual-smart-home/MqttClient.js:52:12)
    at MqttClient.emit (node:events:519:28)
    at Array.<anonymous> (/data/node_modules/node-red-contrib-virtual-smart-home/node_modules/mqtt/build/lib/handlers/publish.js:85:28)
    at MqttClient.options.customHandleAcks (/data/node_modules/node-red-contrib-virtual-smart-home/node_modules/mqtt/build/lib/client.js:94:28)
    at handlePublish (/data/node_modules/node-red-contrib-virtual-smart-home/node_modules/mqtt/build/lib/handlers/publish.js:73:21)
csuermann commented 3 days ago

Hi @turbo2ltr,

Have you checked your DynamoDB table? My hunch is that your user record got auto-deleted after inactivity. You should be able to fix this by just creating a new VSH-connection. Make sure you configure your Node-RED instance to (again) use your own backend.

Hope that helps.

Best, Cornelius

turbo2ltr commented 3 days ago

Ahh dang, I should have waited before I blew everything away. I did look at the Dynamo DB, but I also didn't know what should be in there. All I saw was my devices which seemed like it was working. Is it easy enough to add manually? i.e. is it just a key with my amazon username?

csuermann commented 3 days ago

You'd have to know your Amazon User ID, so I guess manually recreating the record wouldn't work. But creating a new VSH-connection as I pointed out should do the trick.