20.07.2020, 11:13 (This post was last modified: 20.07.2020, 11:13 by JRP.)
Openweather api
Hello
I am implementing the Openweather API in a wiser for KNX.
For now the current time I get it perfectly and I can save the data in virtual objects.
This is the script.
The problem is with weather_descriptions, I see that it is a table and I assign it to an object like the others, if I log it, the contents of the table appear to me, the object is updated but it does not show anything. It is defined as the 14 byte DPT ASCII string. How do I get that data from that table inside another table and assign it to the object?
Also I would like to know if it is possible to use in a conditional loop if a range of numbers, for example that it only be executed if it is between 8 and 10. Since I don't know how to do it I have evaluated each value independently at the end of the script. I do this so that the UV index is displayed in text instead of a number.
a greeting
(20.07.2020, 11:16)admin Wrote: 1. Use current.weather_descriptions[1]
2. You can use Custom Values for object value for easy conversion of number to text
Thanks Admin for such a prompt response.
Effectively with [] it works. What's more, I had tried it but with a point before and that's why it didn't work for me.
What you tell me about custom values I don't know how to do.
Thank you very much
a greeting
Hello
I keep polishing my script for Openweather, now with the direction of the wind.
If I have a value from 0 to 360 degrees of the wind direction, but I want to transform it into a character string according to its denomination of the winds in the Mediterranean:
• North or Terral wind (N): from 337.5 ° to 22.5 °
• Northeast wind (NE): 22.5 ° to 67.6 °
• East or Levante wind (E): from 67.5 ° to 112.5 °
• Southeast wind (SE): from 112.5 ° to 157.5 °
• South wind (S): from 157.5 ° to 202.5 °
• Southwest wind (SW): 202.5 ° to 247.5 °
• West or west wind (W): from 247.5 ° to 292.5 °
• Northwest wind (NW): 292.5 ° to 337.5 °
With the icons I have no problem adding new icons with the addresses and ranges, as if it were a dimmer or a blind.
I know that if I make icons instead of arrows with the text I could do it, but it doesn't seem like a very elegant solution.
Hello
Thanks for the answer but I don't understand it well, I have used it to turn a button and it has not worked for me, could I develop it in more concrete steps?
Thank you
This example will set rotate the icon according to object value (data type 5.003 - angle).
Set Additional classes of your object to rotate
Add to Custom JavaScript:
In object, inside the quotes, I have to put the object that contains the rotation value, in my case 32/2/13 which is the direction of the wind. It is right?
Then as I configure in the visualization, that I select an object or an image and I put it in additional classes rotare?
Of course, it is logical that it is with the wind direction object and not with the object that I show in the image. My mistake.
Now it works perfectly.
Thank you very much.
With the icon already solved, but how could it be done for the names:
• North or Terral wind (N): from 337.5 ° to 22.5 °
• Northeast wind (NE): 22.5 ° to 67.6 °
• East or Levante wind (E): from 67.5 ° to 112.5 °
• Southeast wind (SE): from 112.5 ° to 157.5 °
• South wind (S): from 157.5 ° to 202.5 °
• Southwest wind (SW): 202.5 ° to 247.5 °
• West or west wind (W): from 247.5 ° to 292.5 °
• Northwest wind (NW): 292.5 ° to 337.5 °
Let each value range display the appropriate text on the display.
(02.09.2020, 11:09)admin Wrote: This example will set rotate the icon according to object value (data type 5.003 - angle).
Set Additional classes of your object to rotate
Add to Custom JavaScript:
Yes I found those too. They could work, but in this case those icons doesn´t match the rest of it.
So had hoped to start a rotation of the existing icon that I have.
I had the wiser for KNX disconnected for quite a long time and have put it back into operation.
When I have run the openweather script to check if it is still valid, I happen to get this error in the registry.