Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues after being down for a couple months. #27

Open
turbo2ltr opened this issue Jun 30, 2024 · 9 comments
Open

Issues after being down for a couple months. #27

turbo2ltr opened this issue Jun 30, 2024 · 9 comments

Comments

@turbo2ltr
Copy link

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
Copy link
Author

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
Copy link
Author

turbo2ltr commented Jul 1, 2024

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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.

@turbo2ltr
Copy link
Author

I went into the flows.json and removed the "type: vsh-connection" block so NR would boot.
In the VSH nodes, there was no more connection, so I added a new connection. I entered the logged into my account and used the code to sync..
When I returned to NR, I get the same error but in a nice red box.
image

Do I need to delete the account in a different way?

@csuermann
Copy link
Owner

Are you sure your Node-RED is talking to your backend and not mine? After going through the account linking process, there should be a TOKEN record in the VSH DynamoDB table.

@turbo2ltr
Copy link
Author

Yeah I give up. I have like 10+ hours into this now.. I deleted everything out of my AWS and tried to start completely over, but serverless refuses to complete complaining about running out of memory. (Fresh alpine VM with 2gb of memory)
When VSH works, it's great. Had it running like 3 years without issue. But its deployment has so many moving parts it's unmanageable when it doesn't work.
I REALLY like NodeRed, but maybe HA is the way to go these days..

Also there is nothing in the instructions about having to modify serverless.yml for the proper region. It seems to assume eu-west-1 even if you want us-east-1.

localhost root [~/vsh/virtual-smart-home] # serverless deploy
Running "serverless" from node_modules

Warning: Invalid configuration encountered
  at 'functions.skill': unrecognized property 'regions'
  at 'functions.backchannel': unrecognized property 'regions'
  at 'functions.cleanup': unrecognized property 'regions'
  at 'functions.metrics': unrecognized property 'regions'
  at 'functions.backendApi': unrecognized property 'regions'
  at 'functions.admin': unrecognized property 'regions'

Learn more about configuration validation here: http://slss.io/configuration-validation

Deploying virtual-smart-home to stage dev (us-east-1)
Select: selecting functions for deployment

⠦ Packaging (86s)
⠦ [Webpack] Building with Webpack

<--- Last few GCs --->

[4716:0x7fe951c230b0]    91403 ms: Scavenge (reduce) 982.3 (1002.0) -> 981.8 (1002.3) MB, 49.3 / 0.0 ms  (average mu = 0.247, current mu = 0.041) allocation failure;
[4716:0x7fe951c230b0]    92635 ms: Mark-sweep (reduce) 982.7 (1002.3) -> 980.4 (1002.8) MB, 1018.2 / 0.0 ms  (+ 205.5 ms in 21 steps since start of marking, biggest step 43.5 ms, walltime since start of marking 1593 ms) (average mu = 0.361, current mu = 0

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Aborted

@csuermann
Copy link
Owner

Indeed, the VSH backend was never optimized for self-hosting and setting it up is not straight forward. Perhaps you want to consider using the official VSH backend?! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants