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
61 stars 30 forks source link

Cannot register automation node in SmartThings Developer Workspace #95

Open umiki7 opened 2 months ago

umiki7 commented 2 months ago

I am trying to handle events (such as TV being turned on or off) in Node-red. As I understand an automation node is needed as an input of an event node for that. For the automation node to work, it needs to be registered in the SmartThings Developer Workspace, if my understanding is correct. However this step fails at the app registration verification. The Node-red instance has a working public https URL.

jongsu2 commented 2 months ago

Hello,

Thank you for contacting Samsung Automation Studio Support.

SmartThings Developer Workplace has identified a issues in which the application verification is not completed.

If authentication fails, update the Automation that requested authentication as follows:

View Details -> Edit -> Next -> Next -> Save

This updates the authentication status and activates the 'DEPLOY TO TEST' button.

Please do not hesitate to contact us if you have any further questions.

Thank you.

umiki7 commented 2 months ago

Hi,

Thanks for the quick response. Even after updating the authentication as above, the situation does not change. I cannot proceed to deploy to test because "Verify app registration" step is missing. (As logging is not available at this stage, I cannot even see, if the node-red automation node is reachable and functioning or not.)

thanks!

jongsu2 commented 2 months ago

Hello,

Thank you for contacting Samsung Automation Studio Support.

To use an automation node in Node Red, follow these steps.

1. Create and deploy automation node flow (ex. https://your.com/yourTV) image 2. Add automation app in SmartThings Developer Workplace image 3. Register the automation app

4. Click Verify App Registration image 5. Click DEPLOY TO TEST image 5. Automation app deploy completed image

Please proceed with the procedure above and share the details if any problems arise.

Please do not hesitate to contact us if you have any further questions.

Thank you.

umiki7 commented 2 months ago

Hi,

Thank you very much for the detailed explanation. The process works well from the Samsung Automation Studio, however unable to get past the "app registration" step when trying from Node-red. Node-red itself is accessible through https from the internet. I do not see any relevant information in the logs. Node-red is V4.02, Node.js is v20.17.0, the serves is Ubuntu 22.04.5 LTS.

Thanks!

jongsu2 commented 1 month ago

Hello,

Thank you for contacting Samsung Automation Studio Support.

After reviewing the situation, it appears that the issue may be related to the inbound rules of the EC2 security group.

I recommend testing by temporarily setting the inbound rules to "any open" to see if that resolves the issue.

Please do not hesitate to contact us if you have any further questions.

Thank you.

umiki7 commented 1 month ago

Hi,

Thanks for the suggestion.

My instance is running in the Oracle cloud and basically all traffic is allowed to port 1880 and no egress rules are applied.

Trying from SmartThings Developer directly, there is no sign that the request ever reaches the Automation node (uncommented lines 463-465 in Smartthings.js, I also seeing no incoming requests using a plain http-in node in place of the Automation node neither). I see TCP packages arriving using tcpdump, but no requests received in Node-red.

However, reposting the captured confirmation lifecycle request (Beeceptor + ReqBin) is triggering the expected response (401 (Unauthorized)) and is logged by the Automation node in Node-red.

Please let me know if this problem is not in the scope of this project (i.e. SmartThings Developer or Oracle OCI issue).

Thanks!

jongsu2 commented 1 month ago

Hello,

Thank you for contacting Samsung Automation Studio Support.

Follow these steps to check for request debug messages in the SmartThings Developer Workplace

1. Create and deploy http-in(post) node flow instead of the automation 2024-10-07 11 10 40

2. Add automation app in SmartThings Developer Workplace image

3. Register the automation app

4. Verifying debug messages in node-red 2024-10-07 11 11 51

You can check debug messages when the app is registered.

If the debug message is not output, SmartThings Developer Workplace has failed to access the node-red site for some reason.

In general, access can be restricted by the security of the EC2 inbound, outbound rules, and it seems that automation node and http-in node can be used only when this issue is resolved.

Please correct the issue by modifying the ingress, egress rule of Oracle OCI.

Please do not hesitate to contact us if you have any further questions.

Thank you.

umiki7 commented 1 month ago

According to the Wireshark capture:

35.169.175.96   10.0.0.225  43865 → 1880 [SYN] Seq=0 Win=62727 Len=0 MSS=1460 SACK_PERM=1 TSval=3463758809 TSecr=0 WS=128
10.0.0.225  35.169.175.96   1880 → 43865 [SYN, ACK] Seq=0 Ack=1 Win=65160 Len=0 MSS=1352 SACK_PERM=1 TSval=3136509578 TSecr=3463758809 WS=128
35.169.175.96   10.0.0.225  43865 → 1880 [ACK] Seq=1 Ack=1 Win=62848 Len=0 TSval=3463758909 TSecr=3136509578
35.169.175.96   10.0.0.225  Client Hello
10.0.0.225  35.169.175.96   1880 → 43865 [ACK] Seq=1 Ack=232 Win=65024 Len=0 TSval=3136509693 TSecr=3463758925
10.0.0.225  35.169.175.96   Server Hello
10.0.0.225  35.169.175.96   Certificate, Server Key Exchange, Server Hello Done
35.169.175.96   10.0.0.225  43865 → 1880 [ACK] Seq=232 Ack=1341 Win=61568 Len=0 TSval=3463759030 TSecr=3136509699
35.169.175.96   10.0.0.225  43865 → 1880 [ACK] Seq=232 Ack=1680 Win=61312 Len=0 TSval=3463759030 TSecr=3136509699
**************************************************************************************
35.169.175.96   10.0.0.225  Alert (Level: Fatal, Description: Certificate Unknown)
**************************************************************************************
35.169.175.96   10.0.0.225  43865 → 1880 [FIN, ACK] Seq=239 Ack=1680 Win=61312 Len=0 TSval=3463759213 TSecr=3136509699
10.0.0.225  35.169.175.96   1880 → 43865 [FIN, ACK] Seq=1680 Ack=239 Win=65024 Len=0 TSval=3136509981 TSecr=3463759213
10.0.0.225  35.169.175.96   1880 → 43865 [ACK] Seq=1681 Ack=240 Win=65024 Len=0 TSval=3136509981 TSecr=3463759213
35.169.175.96   10.0.0.225  43865 → 1880 [ACK] Seq=240 Ack=1681 Win=61312 Len=0 TSval=3463759313 TSecr=3136509981

The problem seems to be at the TLS handshake.

The Node-red server uses a Let´s Encrypt certificate and is perfectly functional in other usage (e.g. reaching the web interface etc). In light of that, I presume that SmartThings Developer might have a problem with Let's Encrypt certificates.

jongsu2 commented 1 month ago

Hello,

Thank you for contacting Samsung Automation Studio Support.

We recommend trying a different certificate if you're experiencing TLS handshake issues with a Let's Encrypt certificate.

If the problem persists, please contact SmartThings Support Services for further assistance.

Please do not hesitate to contact us if you have any further questions.

Thank you.

umiki7 commented 1 month ago

Hi,

Thanks for your comprehensive support! Error was indeed on the level of certificate setup, now the node is functional.

Thanks!