Page 2 of 2
Re: OpenUV.io plugin max. 50 request/day
Posted: Monday 25 May 2020 21:33
by Derik
@firewizard
Your last flow is working good? So the plugin is not neaded any more.
Love this option to protect my kids...
Edit:
Which nodes i have to import..?
Re: OpenUV.io plugin max. 50 request/day
Posted: Monday 25 May 2020 22:43
by FireWizard
Hi @Derik,
Import the flow and Node Red will tell you, which nodes you are missing and have to install.
Regards
Re: OpenUV.io plugin max. 50 request/day
Posted: Tuesday 26 May 2020 8:06
by Derik
Hi...
i did hope i have the flow working..

Make the idx for the sensor.
Only i see in the flow a other idx, 8 before the gate node.
What type sensor is this? and what is the function of the sensor.
Re: OpenUV.io plugin max. 50 request/day
Posted: Tuesday 26 May 2020 14:17
by FireWizard
Hello @Derik,
i did hope i have the flow working..

Make the idx for the sensor.
Only i see in the flow a other idx, 8 before the gate node.
What type sensor is this? and what is the function of the sensor.
I think that you refer to the flow, posted at may 24, 2020, 19:19.
This flow was typically made for @Jan Jansen.
In his solution he had a switch, with IDX = 8, that when pushed to On, represents the "Day" situation
and when in "Off" position represents the "Night" situation.
If you copy that flow, then your device with IDX = 8 will control the gate. Which device it is, I don't know, but you can find it under
Setup > Devices.
In the original flow, posted at May 15, 2020, 21:18 h , the gate was not controlled by a simple switch, but by the results of 'Owntracks".
Those, who don't know "Owntracks", this is an app on your phone that sends the lat/lon co-ordinates to your (Mosquitto) MQTT server.
See:
https://owntracks.org/
So, originally the flow was controlled by the day/night node, which depends on the lat/lon co-ordinates of your phone.
But what do you want to achieve?
Best regards
Re: OpenUV.io plugin max. 50 request/day
Posted: Tuesday 26 May 2020 14:27
by Derik
I hope i can use this flow also.
The idx 8 i not more dan a dummy switch that can open the gate when there is sun.
Can i use the flow with that option?
Re: OpenUV.io plugin max. 50 request/day
Posted: Tuesday 26 May 2020 14:42
by FireWizard
Hi,
@Derik,
Yes you can.
It was a "Dummy Switch" (with IDX =8). Create your own switch. Note down the IDX.
If you use the "Filter" node, change the IDX number in the "Filter" node, If you go for the solution without the "Filter" node, you have to modify the
"Function" node and insert your IDX number.
Do not forget to modify the "Function" node, called "Prepare URL Open UV" and insert your own lat/lon co-ordinates and your own X-access token.
Regards
Re: OpenUV.io plugin max. 50 request/day
Posted: Sunday 07 June 2020 19:03
by EdwinK
So... It seems I now have this working. Removed MQTT and node-red completely and reinstalled, now it works as it shoudl.
Just not sure if I have the sensors right.

- Screen Shot 2020-06-07 at 19.01.50.png (87.75 KiB) Viewed 1233 times
Re: OpenUV.io plugin max. 50 request/day
Posted: Sunday 07 June 2020 20:58
by EdwinK
Chanced IDX 552 to an UV sensor
Re: OpenUV.io plugin max. 50 request/day
Posted: Sunday 07 June 2020 21:17
by FireWizard
Hi Edwin
@EdwinK
The sensors you want to use, is in fact up to you. E.g a "Text" sensor can contain more text than a "Custom Sensor".
I have the following:

- Screenshot_OpenUV1.png (55.62 KiB) Viewed 1226 times
For the "Open UV"sensor, called UV index, I use a UV sensor. This one will appear under the "Weather" tab.
For UV and UV max, I use for both an "Alert" sensor. They will appear under the "Utility" tab.
My function node (see below) is based on the use of an "Alert" sensor.
For the "Safe Exposure Time" and the Ozone sensors, I use "Custom" sensors.
On the x-axis of "Safe Exposure Time" you should use min. On the x-axis of "Ozone" you should use DU, which stands for "Dobson Units"
If you want, you can change the icon for a "Custom" sensor, which you cannot for a "Text" sensor.

- Screenshot_OpenUV.png (388.81 KiB) Viewed 1226 times
The contents of the "Function" node in Node Red.
Code: Select all
// Declarations
var msg1 ={}; // UV sensor value
var msg2 ={}; // UV alert
var msg3 ={}; // Max UV
var msg4 ={}; // Ozone
var msg5 ={}; // Max. Exposure Time
// Function to convert UV index to level
function uvi2level(x) {
if (x < 3) {
return 0;
} else if (x < 6) {
return 1;
} else if (x < 8 ) {
return 2;
} else if (x < 11 ) {
return 3;
} else {
return 4;
}
}
msg1.payload = {"command":"udevice","idx":397,"nvalue":0,"svalue":msg.payload.result.uv.toFixed(1).toString() + ";0"};
msg2.payload = {"command":"udevice","idx":398,"nvalue":uvi2level(msg.payload.result.uv),"svalue":msg.payload.result.uv.toFixed(1).toString() + " UVI"};
msg3.payload = {"command":"udevice","idx":399,"nvalue":uvi2level(msg.payload.result.uv_max),"svalue":msg.payload.result.uv_max.toFixed(1).toString() + " UVI" + "\n" + msg.payload.result.uv_max_time};
msg4.payload = {"command":"udevice","idx":400,"nvalue":0,"svalue":msg.payload.result.ozone.toString()};
msg5.payload = {"command":"udevice","idx":401,"nvalue":0,"svalue":msg.payload.result.safe_exposure_time.st3.toString()};
return [[msg1,msg2,msg3,msg4,msg5]];
Re: OpenUV.io plugin max. 50 request/day
Posted: Monday 08 June 2020 9:45
by EdwinK
Thanks for your answer. Glad to finally having this work.
(Onwards to find something for lux

)
Re: OpenUV.io plugin max. 50 request/day
Posted: Thursday 21 April 2022 15:53
by Jan Jansen
The sun is shining more and more intensely so I regularly look at my UV sensors again. I use the flow below (thanks @FireWizard). Unfortunately, the flow gives an error message (see sidebar). I can't explain the error and therefore can't fix it. The settings of the moment node can also be found below. Does anyone have an idea how to fix this?
Thanks in advance.
Regards,
Jan

- OPenUV flow.png (92.51 KiB) Viewed 913 times
Re: OpenUV.io plugin max. 50 request/day
Posted: Thursday 21 April 2022 16:34
by FireWizard
Hello Jan (@Jan Jansen)
This error message comes from the "moment" node, called Date/Time Formatter.
As you can see in the Debug output below msg.payload.result.uv_max_time exist.
However I see that your moment node shows a different "Edit" window. Might it, that you use an older version?
Mine looks like:

- Screenshot_moment_node_config.png (36.99 KiB) Viewed 912 times
I do not use that node, but you might also try to put as "Input
msg msg.payload.result.uv_max_time instead of only payload.result.uv_max_time.
If it works do the same with the Output
msg.
Let me know.
Regards
Re: OpenUV.io plugin max. 50 request/day
Posted: Thursday 21 April 2022 20:35
by Jan Jansen
FireWizard wrote: Thursday 21 April 2022 16:34
However I see that your moment node shows a different "Edit" window. Might it, that you use an older version?
My system is up to date. I can't explain why my moment node looks different.
Changing the input and output msg has no effect. Which node do you use instead of the moment node?
Regards,
Jan
Re: OpenUV.io plugin max. 50 request/day
Posted: Thursday 21 April 2022 21:28
by FireWizard
Hello Jan (@Jan Jansen),
I use: node-red-contrib-moment and then specific the moment node.
See:
https://flows.nodered.org/node/node-red-contrib-moment
Code: Select all
[{"id":"a4c34c84.d9cda","type":"moment","z":"27808d8a.76f2c2","name":"","topic":"","input":"payload.result.uv_max_time","inputType":"msg","inTz":"Europe/Amsterdam","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD-MM-YYYY HH:mm:ss","locale":"en_US","output":"payload.result.uv_max_time","outputType":"msg","outTz":"Europe/Amsterdam","x":680,"y":100,"wires":[["e94602a.c7aa3"]]}]
It is called "Date/Time Formatter".
This works fine for me.
If you need another copy of my flow, let me know.
Regards
Re: OpenUV.io plugin max. 50 request/day
Posted: Friday 22 April 2022 12:58
by Jan Jansen
@FireWizard,
Thanks, it works again! I used node-red-contribute-moment2. With that, the flow has worked well before. The icon of the moment node is exactly the same as the icon of the moment node of node-red-contribute-moment. Under the hood there are differences.
Regards,
Jan
Re: OpenUV.io plugin max. 50 request/day
Posted: Friday 22 April 2022 13:54
by FireWizard
Hi @Jan Jansen.
I have never used node-red-contribute-moment2 and I assume it should work. And as you said it worked before.
But let us not waste time on it, as it woks again now.
Regards