Samsung / SamsungAutomationStudio

Samsung Automation Studio is to provide development tools and execution environment that can easily configure application logic by connecting both Samsung service and 3rd party service. This project is to share the node for open source NodeRED developed by Samsung Automation Studio team to the community. If you are using nodered, you can easily install the node we provide. And you can use Samsung's IoT and AI-related services more easily, and you can have an extended experience in conjunction with your own services.
Apache License 2.0
56 stars 29 forks source link

Samsung PAT token doesn't automatically reconnect after restart #18

Closed brianoden closed 3 years ago

brianoden commented 3 years ago

First off I wanna say this is A mazing! I'm running HA on a virtual server, and I'm using an instance of node-red in HA to connect using "node-red-contrib-samsung-automation-studio-nodes". I got the PAT and connected to my Samsung account and shows my tv in the node. I can control my tv! Then when I do other things that I have to restart the HA server, the node disconnects and won't reconnect automatically. I have to go back to the node and enter the same PAT number to reconnect. I do wanna add that my TV is a 2016 model UN55KU6290. I haven't been able to add it to smartthings (I'm assuming the model is not supported in the app). But never the less the TV is registered with Samsung and displays on the node. Please help. This would be amazing if I could solve. Thanks so much!!

shgood commented 3 years ago

Hi, I think that your node-red server cannot communicate with the SmartThings server. because SmartThings node manages PAT token information (SmartThings devices and locations) on the server. (not browser)

If it's right, you could see the log message below on the server "SmartThings pat= failed, getDevices failed : Error: unable to verify the first certificate / getLocations failed : Error: unable to verify the first certificate"

So, I think you need to check the connection between your node-red server and the SmartThings server.

brianoden commented 3 years ago

Hey, Thank you for the response!! I've been searching the internet for how to view the log file for node-red and I'm coming up empty handed. I'm running it as an addon in HA, on a virtual machine. Can you kick me a link or walk me through how to access it? I'd really appreciate the additional help.
On an additional note... I can't add the TV to my smartthings app because it's model is not supported by the phone app. I also noticed that the device says "undefined" in the device list in node-red Node red . But you're right, If I can access the log file it would be helpful first step.

brianoden commented 3 years ago

Found the log. In the logical place of course lol. Here is the error.. SmartThings pat= failed, getLocations failed : 403 Forbidden

shgood commented 3 years ago

I think you have to find a way to make your server communicate with SmartThings API. i.g. modify network config / modify proxy setting (if you have)

On the other hand, regarding this issue, It would be better to modify the my-device nodes so that they can operate independently of the server. I will modify this part in the next release. So... If you cannot fix your network issue, or If you don't mind, please wait for the next release.

Thank you.

brianoden commented 3 years ago

I'm sure it's a network issue on my part, I'm running a Dream Machine to control everything. I'll work on it and would be happy try it again in the future if I can't get it to snap or buy a TV not 8 years old and try it again, lol. Last question I have is there a specific port I should be opening on my network? Thanks so much! I think this is a great node!