-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Create shared attribute from device #148
Comments
Just while thinking of it, maybe attributes is not the best way to accomplish remote configuration of the devices. A new type of communication may be introduced, a settings one, allowing just that:
What do you think? |
I'm busy setting up shared attributes one device by one device manually for tens of devices. 😭 |
Yes this is bad. But my use case is worse, since we don't even know the attributes of each device... The user has to configure the device, according to his needs, and then the device has to notify the server about the actually supported features. This is not possible currently. |
@fotis400 I disagree that this is not possible. We try to make TB as generic as possible. Of course, something always will not be available out-of-the-box, but you can easily add this functionality. I suggest following idea based on existing functionality:
Using this flow you have some benefits:
Unless you or someone disagree I am going to close this soon. P.S. @jakocoo you can use REST APIs to automate the process you have described. |
I understand your generic approach, but device remote configuration is a common problem faced by most embedded systems. Although there is a work-around as you stated, it seems to be just this, a work-around. Lot's of work, for a standard necessity. And of course there is always the case not to have a widget for this, and let the tenant administrator directly manipulate the attributes, just as it is already happening with the shared attributes. Are there any plans for more powerful remote configuration? Or at least for the moment why not just let the device create the shared attribute, what's wrong with that? |
Hi @ashvayka |
To implement the approach proposed by @fotis400 we need a rest API to create a shared attribute. Any Help is very appreciated! |
hey @andreavitaletti @jakocoo |
@jakocoo @andreavitaletti @zimmele2 please see #731 for also with manipulating shared attributes, instead of just creating them, and let us know what you thing. |
I also have the same problem. How can the equipment update the attribute problem? |
Well the answer is here:
And for version 1.3 and on that URL needs to be:
You can update multiple shared attributes at once, by doing a post request on the above with the parameters in json encoding.... |
As per ThingsBoard documentation only client attributes can be updated from the device, shared attributes can only be sent to the device, and service attributes can only be changed with the application and not device itself. |
@yefimov-andrey Indeed I have read the documentation, and indeed there are ways to automate shared attributes creation. But the problem persists. Since it is a "shared" attribute, and the device has access to it (read and write), it should be also able to create it. It seems that many people have the same request. |
Shared attributes can be updated from the rule engine, the type of attribute saved can be changed in a corresponding attribute. In version 2.5/3.0 shared attributes can be edited from UI. Or is this different from what you wanted to see? |
Hi @yefimov-andrey Well... Yes and no... You can indeed choose the type of the attributes to be saved. However the current API does not allow to distinguish between shared and client attributes. They are sent all together. Thus it is impossible for the rule engine to know which attributes are to be saved as client attributes, and which as shared ones. Everything arrives in a single packet, and handled together. Since they cannot be distinguished you are effectively forced to use only one type of the two. And since they originate from the device, I can only assume that they are client attributes. Thus the device cannot create shared attributes (in theory it can, but effectively not). |
Hi , thanks in advance. |
Hey there, is this format still valid? I'm trying to send a simple attribute for creation/update. Here is the data I'm sending:
I keep getting status:405 error:"Method not Allowed" message:(empty):
I am able to successfully GET the attributes, however I can't POST and update them. Tried with server, shared and client attributes and with no success... tried with several options listed on the Swaggerui (specifically, saveEntityAttributesV1,saveEntityAttributesV2, and saveDeviceAttributes) but no success... (to be honest, It's a bit confusing for me, no indication of how the body should be sent). My successful GET looks something like this:
And yes, I'm passing the jws token, just as I do with the GET and am able to see the attribues. I would greatly appreciate any guidance or pointers on this one, thanks. |
Never mind guys, my dumb a** mind was sending a GET instead of a POST with python requests library... :o) so yes, the format is still the same. Again don't forget the "Bearer" and the Token |
A shared attribute must be able to be created from the device, not only through the WebUI.
Take for example a device that uses a set of attributes to store various settings.
If the device adds these attributes (as client-side attributes), then they will appear as read-only attributes in the UI, not allowing remote configuration of the device.
If the attributes are added as shared-attributes, so as to have the ability to change them (and thus configure the device remotely), then the Tenant administrator has to add them all manually, and most importantly has to know them! You lose the ability to have the device advertise on its own the supported attributes.
The text was updated successfully, but these errors were encountered: