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

ST_EVENT_DEVICE node error due to subscriptionName error #23

Closed iquix closed 3 years ago

iquix commented 3 years ago

Hi. 안녕하십니까

I'm a big fan of Smartthings Automation function in Samsung Automation Studio. SmartThings 자동화를 위해 Samsung Automation Studio를 사용하고 있는 사용자입니다.

I would like to address a bug, which is already debugged in SASM website, but not in github / npm package SASM웹사이트에서는 버그 수정이 되었으나, github / npm package에는 버그수정 되지 않은 부분이 있어서 부탁드립니다.

There's a bug in ST_EVENT_DEVICE node while requsting event subscription to ST platform server, due to subscriptionName error. ST_EVENT_DEVICE 노드의 event subscription시 ST플랫폼 서버로 보내는 subscription의 subscriptionName 부분의 오류입니다.

https://github.com/Samsung/SamsungAutomationStudio/blob/dev/101-SmartThings.js#L375 in line 375 of the code, 375째줄 이 부분에서,

subscriptionName: (eventDevice.name+''+eventDevice.capabilityId+''+eventDevice.attributeId+'_SUBS').slice(0,32) is defined as above, 인데..

https://github.com/Samsung/SamsungAutomationStudio/blob/dev/101-SmartThings.js#L253 in line 253 of the code, however, name is never defined. 253째줄 이 부분에서 name은 선언되지 않습니다.

Since, eventDevice.name is undefined, eventDevice.name은 undefined이다보니..

subscriptionName is formatted as captured image below. 아래 캡쳐화면과 같은 형태로 subscriptionName이 나옵니다. image

The problem is, when you subscribe 2 or more devices with SAME CAPABILITY, (like 2 switch events in the example above), 'subscriptionName' field in the subscription request packet becomes identical between those. Therefore, second subscription request fails like the captured image above. 문제는 첨부파일1과 같은 사례처럼 ST_EVENT_DEVICE로 동일한 capability 기기를 2개 이상 선언할 경우, (위 예제에서는 event node로 switch를 2개 선언하였습니다), 그 2개의 event subscription요청에 대한 subscriptionName이 그 2개가 똑같이 나와서, 두번째 기기의 subscription 요청에 대해서는 위 캡쳐화면과 같이 오류가 납니다.

This problem persisted for quite a long time, but recently it seems that this bug is fixed in SASM website. 이 오류가 한동안 지속되었다가, SASM웹사이트에서는 수정이 된 듯 합니다.

As you can see in the captured image of SASM website, subscriptionNames do not get duplicated. 아래의 캡쳐화면을 보시면, subscriptionName이 겹치지 않게 잘 선언되어 호출됩니다. image

However since this bug has not been fixed in github / npm package, I get errors on my node red server. 그런데, 위 링크와 같이 github / npm package쪽에는 수정되지 않아 개인 node red 서버에서 운용시 상기 이유로 오류가 지속됩니다.

I would appreciate if you fix the bug in the github / npm package. Thank you. github/npm package에서도 해당 버그에 대한 수정을 해 주신다면 매우 감사드리겠습니다.

dplaya-min commented 3 years ago

안녕하세요. 상세하게 이슈 등록해 주셔서 감사합니다. 보고 된 이슈는 말씀하신데로 수정하여 반영 하겠습니다.

shgood commented 3 years ago

@iquix 안녕하세요. 해당 이슈 수정하여 1.1.7버전으로 반영하였습니다. 버전 업데이트 후 사용해주세요. 감사합니다.

iquix commented 3 years ago

@shgood Thank you so much. It works well as expected. 정말 감사드립니다. 잘 됩니다.