I created a new webthing with new properties, the gateway client complains with “Unable to build property detail for:” .
Can anyone provide pointers to the API to use so I can write code to handle new read & write properties?
I created a new webthing with new properties, the gateway client complains with “Unable to build property detail for:” .
Can anyone provide pointers to the API to use so I can write code to handle new read & write properties?
What does your full thing description look like? That should provide some insight.
The API is documented here: https://webthings.io/api/
No, the webthing API is for the back-end if I understand correctly, what I need to know is how to tweak the UI in order to define how the user interacts, via a browser, with the graphical representation of a thing and its properties.
I need to find out how I write code to define how to present my webthings and properties in the gateway UI and to which API.
I have for instance a more generic channel_brightness
property instead of color
.
Example use:
{
channel_brightness:
{
Red: 0.6
Green: 0.3
White: 0.999
}
}
Where the device can have any number of channels, with any sort of name, and not limited to discrete values from 0 to 255.
In the UI, I need to be able to present efficient ways to input possible value for some of the possibilities (e.g. a four-channel colour picker, RGBW), but also leave a door open for further additions should someone want to use my properties in ways I did not anticipate (more channels, different names, other purposes than colour).
In the future I also want to create more complex properties to control changing colours. An image file can be used as a sequential source of colour dots, paired with timing data, this controls how a light can be made to change. A function based colour and timer selector could do the same. A combination of functions and images could control a light. All this needs to be made easy to interact with in the UI. For this I need to find out how to hook into the UI from an add-on point of view, particularly with new types of properties.
Ok, so what you really want are property values which are objects. Is that correct?
Yes, for some, though not necessarily.
I think I found where in the gateway code this happens, but i am clueless as of yet about how to interface with it, if at all possible: static/js/context-menu.js
. Or maybe not.
Property views are all built up dynamically, here: https://github.com/WebThingsIO/gateway/blob/master/static/js/schema-impl/capability/thing.js
Yes, that looks like what I am looking for.
How do I add my own (as part of an add-on)?
Is there some example code for this?
What is the API?
Oh, and does that mean I can redefine an existing representation of a thing/property?
Presently, there is no good way to add that functionality through an add-on. We would gladly accept pull requests for the gateway, though!
Thanks for the clarity.
As to contributing, I am game, but the learning curve is steep - especially since I can’t see much in the way of explanatory comments in the code. So I’ll give this a go, but I might be slow.