I was just going through the eWeLink open API 2 and there is a “wind-speed” capability but there isn’t in the Register Device node. I am wondering if wind-speed is missing from the list as wind-direction is the next capability in both the eWeLink Cube API 2 and the Register Device Node.
The reason I went through the lengthy document, although I got bored and started skipping bits is that I thought it’d detail how to make an iHost Custom tile similar to the Tile2cube-Weather API docker but with live measurements from garden (I have an 8 in 1 [Temp/Humid/Light/UV/rain/WindSpeed/WindDirection/pressure] Seeed Studio sensor that uses LoRa/M2Gateway-localMode/ChirpstackV4/MQTT/iHostNR). and a custom tile would be an excellent way to display the information, plus I was hoping to be able to copy and paste quite a lot from the current weather docker. Did I miss that bit in the document or is the example docker on GitHub?
The “wind-speed” capability is called “Fan Speed” in register-device node.
Custom tile api should be in Custom UI Card section of the open API v2 documentation.
Thank I did wonder if a Card was a Tile. I’m going to re-read that bit. By that section I was not much concentrating.
I had found this before , as also the Wind Direction capability, but although I´ve spent much time going through the Device Management Function Supported Device Type section of the API documentation not been able to set up a virtual device. Have created General Sensor and then tried populating capabilities but no joy. Also I cannot find any reference to the use of the new “Permissions” and “Settings” (JSON) fields.
Without some form of example this is very difficult, and nothing seems forthcoming.
Can you give any example about how you setup a virtual device?
Maybe We can walk you through with some answers and documentation.
Are you using open api v2?
If so, the description and reference for permission and settings should in the documentation.
OK Thanks for the offer !
This is the register node for creating a virtual device that I have, which I wanted to be able if possible, sync to the incoming windspeed and direction values from the OpenWeather API.
The resulting device shows only battery and RSSI.
[
{
"id": "8d22da03ad925191",
"type": "register-device",
"z": "d8bbbc77576829fa",
"name": "NRWS Sensor",
"server": "4cdde9acd4eff76f",
"device_id": "65102aea-9698-11ef-b864-0242ac120002",
"device_name": "NRWS Sensor",
"category": "sensor",
"capabilities": "null",
"manufacturer": "John",
"model": "NRSW",
"firmware_version": "v1",
"service_address": "192.168.0.85",
"tags": "{}",
"state": "{\"battery\":{\"battery\":100},\"rssi\":{\"rssi\":100},\"wind-speed\":{\"wind-speed\":50},\"wind-direction\":{\"wind-direction\":10}}",
"capabilities_v2": "[{\"capability\":\"battery\",\"permission\":\"1111\"},{\"capability\":\"rssi\",\"permission\":\"1111\"},{\"capability\":\"wind-speed\",\"permission\":\"1111\"},{\"capability\":\"wind-direction\",\"permission\":\"1111\"}]",
"x": 635,
"y": 4935,
"wires": [
[]
]
},
{
"id": "4cdde9acd4eff76f",
"type": "api-server",
"name": "Token",
"ip": "192.168.0.85:80",
"ipaddr": "",
"token": "70320e15-887e-4d48-ad3e-3d12061c6925"
}
]
I honestly can´t find what I need in the API documentacion.
For the initial state I have …
{
"battery": {
"battery": 100
},
"rssi": {
"rssi": 100
},
"wind-speed": {
"wind-speed": 50
},
"wind-direction": {
"wind-direction": 10
}
}
Thanks.
I tried your node.
The initial states are wrong.
Should be as following:
{
"battery": {
"battery": 100
},
"rssi": {
"rssi": 100
},
"wind-speed": {
"windSpeed": 50
},
"wind-direction": {
"windDirection": 10
}
}
The outer key of state often write in kebab case and inner key write in camel case.
Corrected that , and now have Wind Direction, with an initial value attributed . Great, but still no Wind Speed…
As you can see here so far I have not edited Settings, and have left permissions in Device Control and Device Status Reporting as I don´t see any guidelines on that
type or paste code here
```[
{
"id": "8d22da03ad925191",
"type": "register-device",
"z": "d8bbbc77576829fa",
"name": "NRW Sensor",
"server": "4cdde9acd4eff76f",
"device_id": "8bc08520-96c7-11ef-b864-0242ac120002",
"device_name": "NRW Sensor",
"category": "sensor",
"capabilities": "null",
"manufacturer": "John",
"model": "NRSW",
"firmware_version": "v1",
"service_address": "192.168.0.85",
"tags": "{}",
"state": "{\"battery\":{\"battery\":100},\"rssi\":{\"rssi\":100},\"wind-direction\":{\"windDirection\":15},\"wind-speed\":{\"windSpeed\":50}}",
"capabilities_v2": "[{\"capability\":\"battery\",\"permission\":\"1100\"},{\"capability\":\"rssi\",\"permission\":\"1100\"},{\"capability\":\"wind-direction\",\"permission\":\"1100\"},{\"capability\":\"wind-speed\",\"permission\":\"1100\"}]",
"x": 625,
"y": 4935,
"wires": [
[]
]
},
{
"id": "4cdde9acd4eff76f",
"type": "api-server",
"name": "Token",
"ip": "192.168.0.85:80",
"ipaddr": "",
"token": "70320e15-887e-4d48-ad3e-3d12061c6925"
}
]
The guideline is in the description.
There’s a link link to the documentation.
Thanks, I´m trying to get this to work now and although the documentacion explains this, it´s not clear until you´re used to it, how this is configured on the register node. Up until this point any virtual device I´ve created (switch, light, button etc) have not needed any more configuration than the very basic.
- Do I understand correctly that the permissions in a device like this should be Device controllable and reportable:
"1100"
? - That means selecting both in the register node *Permission box?
- And then editing the JSON text in the Settings field to 1100, leaving all between
[]
brackets? - The information on the Attributes (State) is specified in the Device Initial State JSON field - where is this entered then?
Sorry to have to ask so many questions but I´ve been trying all ways of editing this and not getting anywhere.
- Do I understand correctly that the permissions in a device like this should be Device controllable and reportable:
"1100"
?
1 means able, 0 means inable. Four digis from left to right: controllable, reportable, configurable and queryable. - That means selecting both in the register node *Permission box?
Checked means 1 and unchecked means 0. - And then editing the JSON text in the Settings field to 1100, leaving all between
[]
brackets?
I can quite understand, can you provide some pic? - The information on the Attributes (State) is specified in the Device Initial State JSON field - where is this entered then?
Still don’t understand.
What do you mean by “where is this entered”?
Hi. I´ve been trying this but can´t seem to get it working.
I select here…
…then paste exactly this code into the Settings box. I tried editing permission binary codes but to no avail, so here it is identical to the documentation.
[
{
"capability": "wind-speed",
"permission": "0100",
"settings": {
"windSpeedRange": {
"type": "numeric",
"permission": "01",
"min": 0,
"max": 50
}
}
},
{
"windSpeed": 50
}
]
As you can see I have entered here both the Capability Declaration and, at end the Attributes (State)
What am I doing wrong for this not to function? Wind Direction works fine and I can sync with OpenWeather but after many tests I can´t make this work with wind speed.
Thx
As you can see, capability setting and capability state is different part of the device data.
The Settings field only fill with setting data and the state field fill with state data.
So your setting field should looks like:
[
{
"capability": "wind-speed",
"permission": "0100",
"settings": {
"windSpeedRange": {
"type": "numeric",
"permission": "01",
"min": 0,
"max": 50
}
}
}
]
And your state field should looks like:
{
"wind-speed": {
"windSpeed": 50
}
}
OK, followed your guide and have setup the register node as
[
{
"id": "8d22da03ad925191",
"type": "register-device",
"z": "d8bbbc77576829fa",
"name": "NRW Sensor",
"server": "4cdde9acd4eff76f",
"device_id": "8bc08520-96c7-11ef-b864-0242ac120002",
"device_name": "NRW Sensor",
"category": "sensor",
"capabilities": "null",
"manufacturer": "John",
"model": "NRSW",
"firmware_version": "v1",
"service_address": "192.168.0.85",
"tags": "{}",
"state": "{\"battery\":{\"battery\":100},\"rssi\":{\"rssi\":100},\"wind-direction\":{\"windDirection\":240},\"wind-speed\":{\"windSpeed\":10}}",
"capabilities_v2": "[{\"capability\":\"battery\",\"permission\":\"1100\"},{\"capability\":\"rssi\",\"permission\":\"1100\"},{\"capability\":\"wind-direction\",\"permission\":\"1100\"},{\"capability\":\"wind-speed\",\"permission\":\"1100\",\"settings\":\"{\\\"capability\\\":\\\"wind-speed\\\",\\\"permission\\\":\\\"1100\\\",\\\"settings\\\":{\\\"windSpeedRange\\\":{\\\"type\\\":\\\"numeric\\\",\\\"permission\\\":\\\"11\\\",\\\"min\\\":0,\\\"max\\\":50}}}\"}]",
"x": 625,
"y": 5250,
"wires": [
[]
]
},
{
"id": "4cdde9acd4eff76f",
"type": "api-server",
"name": "Token",
"ip": "192.168.0.85:80",
"ipaddr": "",
"token": "......................."
}
]
But this still does not register the virtual device. If I delete the Wind Speed capability and state then it shows correctly.
Sorry to insist but I am unable to get this to function.
Thank you @SuiKa
Sorry about earlier, guess I got lost in the setting field for a bit.
This is your setting now.
{
"capability": "wind-speed",
"permission": "1100",
"settings": {
"windSpeedRange": {
"type": "numeric",
"permission": "11",
"min": 0,
"max": 50
}
}
}
But actually the field is about setting, so we don’t need the capability and permission parts( they are set by other field).
So the setting should be:
{
"windSpeedRange": {
"type": "numeric",
"permission": "11",
"min": 0,
"max": 50
}
}
THANK YOU!! That was it, although the "permission line has to be 01, but now it runs with the values from Open Weather
Glad you make it!
Enjoy the new device!