smartthingscommunity / smartthings-core-sdk Goto Github PK
View Code? Open in Web Editor NEWSDK for calling the SmartThings API from JavaScript and TypeScript applications
License: Apache License 2.0
SDK for calling the SmartThings API from JavaScript and TypeScript applications
License: Apache License 2.0
called subscribeToDeviceHealth() function.
when device goes to offline or online, DEVICE_HEALTH_EVENT is supposed to be come.
but it is not.
scope":["r:locations:","x:devices:","r:devices:*"] are used.
but subscribeToDeviceLifecycle() is well working, when device is registered and unregistered with DEVICE_LIFECYCLE_EVENT.
What is your question? Please describe.
A clear and concise question.
Additional context
Add any other context or screenshots about the question here.
Hello!
I hope you are doing well!
We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.
Can you enable it, so that we can report it?
Thanks in advance!
PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository
error: invalid path 'test/unit/data/history/get?after=1596813799499&afterHash=1424849460&limit=20&oldestFirst=false&offset=0&locationId=3749dfe2&deviceId=c8fc80fc.ts'
fatal: unable to checkout working tree
Commit dd95c5b
Describe the bug
The documentation mentions a changes operation that is not present in the sdk.
To Reproduce
Try to create a rule with the changes operation.
Expected behavior
Expect the SDK to implement the documented operations
Actual behavior
Missing changes operation
create subscription API method doesn't match. I think It should be POST, but PUT.
API description : https://librarian-regionals.smartthingsgdev.com/api/api.smartthings.com.v1#operation/saveSubscription
core-sdk :
error console :
Error: Request failed with status code 405: {"requestId":"D70F1365-36AE-4990-9BAE-5D3EDCF8E5E7","error":{"code":"MethodNotAllowedError","message":"PUT is not an allowed HTTP method for the requested resource.","details":[]}}
Hi,
Everythings seems to work very fine, but Subscriptions documentation is quite messy. I cannot figure out how to subscribe my device events.
const authenticator = new BearerTokenAuthenticator({
token: 'xxxxxxx',
});
const client = new SmartThingsClient(authenticator);
client.locations.list().then(locations => {
console.log(FoundFoundFound ${locations.length} locations
)
}) .catch(err => { console.log('errerrerr',err);
});
I am getting 401 Authorization Required for a proper PAT
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
The npm token configured in the NPM_TOKEN
environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/
.
If you are using Two-Factor Authentication, make configure the auth-only
level is supported. semantic-release cannot publish with the default auth-and-writes
level.
Please make sure to set the NPM_TOKEN
environment variable in your CI with the exact value of the npm token.
Good luck with your project β¨
Your semantic-release bot π¦π
What is your question? Please describe.
Is there a call to get the serial number of a device?
Additional context
I want to get the serial number of my TV using the SmartThings API. I could not find it using one of the API calls. Is there one that I might have missed or is getting the serial number not supported?
Smart Things does not support an energy monitor? Samsung WindFree model does not support an energy monitor add-on.
I used this project with Typescript to create a new rule and typing is misleading us on the data structure.
For example: greaterThan
should be greater_than
and _else
should be else
When I follow the typing I receive this from the server:
{"code":"BodyMalformedError","target":"greaterThan","message":"Unknown field on line 1","details":[]}]}
If you don't want to use the same name convention on JS side, you should at least process the data to remap them.
Is there a way to delete devices within installedAppId?
(delete the devices installed by specific Installedapp)
smartthings-core-sdk/src/endpoint/devices.ts
Line 320 in 57b01a6
Is there a way to create devices with not only locationId but also the roomId?
(If I use the create api, it only generates the device at the location with no room specified)
smartthings-core-sdk/src/endpoint/devices.ts
Line 330 in 57b01a6
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
semantic-release cannot push the version tag to the branch master
on the remote Git repository with URL https://github.com/SmartThingsCommunity/smartthings-core-sdk
.
This can be caused by:
Good luck with your project β¨
Your semantic-release bot π¦π
Is your feature request related to a problem? Please describe.
While writing a custom script to trigger functionality in my Samsung Fridge, I noticed that this SDK did not support the REST API's ordered parameter in the SDK
Describe the solution you'd like
Add an optional ordered parameter that adds an ordered parameter to the executeCommands payload when ordered === true
Describe alternatives you've considered
None at this time - you could technically add another method to the SDK, but the suggested implementation is simpler and wouldn't break the existing API
As an example, let's call the executeCommand
call in the devices API:
client.devices.executeCommand(id, command).then(result => {
this.log(`success: ${result}`)
}).catch(error => {
this.log(`error = ${error}`)
})
This method always returns successfully even when the API returns an error. Simply adding an await
to the executeCommand
fixes the issue:
public async executeCommands(id: string, commands: Command[]): Promise<Status> {
// TODO: add this await here
await this.client.post(`${id}/commands`, { commands })
return SuccessStatusValue
}
NOTE: This will need to be added consistently throughout the SDK.
Hello,
I own a samsung connected washer.
I can't change the cycle.
client.devices.executeCommand(WASHER_ID, { "component": "main", "capability": "samsungce.washerCycle", "command": "setWasherCycle", "arguments": ["Table_02_Course_25"] } ).then((response) => { console.log(response); });
The response of the webservice is fine:
{ status: 'success' }
But the cycle of my washer remains untouched with this command.
Can you help me?
Thank you
This still appears wrong to me
smartthings-core-sdk/src/endpoint/rules.ts
Line 230 in 25dbf42
and I'm getting
[{\"code\":\"BodyMalformedError\",\"target\":\"_else\",\"message\":\"Unknown field on line 1\",\"details\":[]}]}}'
back from the API.
This issue was somewhat referenced in #56 with a claim it should now sync up but it seems to still be outstanding.
From what I see, the _else?
property should be else?
, as the code at the bottom of the same file i referenced just puts that exact JSON object into the api body payload, and according to the api docs and all JSON payload examples I see it is incorrect?
Describe the bug
Event Data is empty
To Reproduce
Subscribe to events form the schalge device and the data object in the event will always be empty despite the CLI's edge:drivers:logcat command showing the data object for the event from the driver has a value:
(Home Schlage Door Lock)> emitting event: {"component_id":"main","capability_id":"lock","attribute_id":"lock","state":{"value":"locked","data":{"method":"command"}}}
and here's the event from the SDK:
{"eventTime":"2023-09-14T11:17:51Z","eventType":"DEVICE_EVENT","deviceEvent":{"eventId":"","locationId":"","ownerId":"","ownerType":"LOCATION","deviceId":"","componentId":"main","capability":"lock","attribute":"lock","value":"unlocked","valueType":"string","stateChange":true,"data":{},"subscriptionName":"*"}}
Expected behavior
the data object should be populated as captured by the edge driver
Actual behavior
the data object is empty
In the CLI, we have already converted code to prefer type
over interface
. Let's do the same in this project.
In the end we want this in our eslint.js
file:
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
903218
https://github.com/SmartThingsCommunity/smartthings-core-sdk/wiki/Devices#deprecated-functions
getCapabilityState - Gets the attribute values of the specified component capability. Deprecated use getCapabilityState() instead.
getCapabilityState - Gets the attribute values of the specified component capability. Deprecated use getCapabilityStatus() instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.