more G-Labs products

Author Topic: Buienradar (Rain radar) for NL and BE users  (Read 8485 times)

June 01, 2015, 07:49:12 PM
Read 8485 times

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
Buienradar is a Dutch language site which shows the current and expected rainfall for Belgium and the Netherlands.

They have a simple feed for retrieving expected rainfall for the coming two hours.

This is a first version of a Rainfall widget, so it's probably a bit buggy and the code definitely needs a clean up. But I wanted feedback about how to improve, any help will be greatly appreciated. :)

You can set the following parameters:
  • Latitude
  • Longitude
  • Refresh rate in minutes
  • Threshold - (for example .05)

It outputs the following:
  • Buienradar.RawData - Used to populate the 'Rain Graph'
  • Buienradar.RainExpected - number of minutes until rain is expected (zero if no rain expected)
  • Buienradar.RainThresholdExpected - number of minutes untill rain over the given threshhold is expected (zero if no rain expected)

Place the files in the zip in the following folder: homegenie/html/pages/control/widgets/Arend/buienradar

Edit: 08-07-2015 uploaded latest versions of files.

Edit: 07-08-2015 uploaded new version with changes by Dani

Edit: 28-08-2015 New widget files (buienradar.zip) which shows Rain radar map when clicking on the widget.
« Last Edit: August 28, 2015, 08:45:47 AM by mvdarend »

June 02, 2015, 06:52:37 AM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
A few people downloaded this yesterday, but I accidently had uploaded the wrong widget files. You'll need to download the new .zip file for the correct version.

June 02, 2015, 12:21:07 PM
Reply #2

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219

June 03, 2015, 08:49:53 AM
Reply #3

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
It's works for me. Thx
Thanks for the feedback KaZe.

I've noticed a couple of things that need work.

The feed usually has a start time of approx. 10 minutes earlier than the current time. The calculation in the current version is not very good, it doesn't look at the actual times but counts 5 minutes for every data point. For example if you retrieve the feed at 10:00 the start timeof the feed will most likely be 09:50, if rain is expected at 10:05 the value for RainExpected will be 15 instead of 5)

Graph could probably be more active, changing bar sizes depending on the maximum rain value expected.


June 04, 2015, 08:56:03 PM
Reply #4

Peter1977

  • *
  • Information
  • Newbie
  • Posts: 24
great! i'll try it out tommorow

thanks!

June 05, 2015, 05:19:24 PM
Reply #5

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
I've uploaded a new version with the following changes:

- Threshold spelt properly... :-[
- Cleaned up the code a little
- Added more info to the widget (Max. rainfall expected).
- RainExpected and RainThresholdExpected now give the actual amount of minutes until rain is expected instead of a very badly calculated guess.

I've noticed that the feed will often give false rain values with a very low amount of rain expected. As far as I can see it is always below 0.05 mm per hour, so you can always set  the Threshold to that.

Here's a quick C# example for closing the Awning when rain is expected:

Code: [Select]
When.ModuleParameterChanged( (module, parameter) =>
                            {                             
                              if (module.Is("Buienradar"))
                              {         
                                if(parameter.Name == "Buienradar.RainThresholdExpected" && parameter.Value != "0")
                                {
                                  // Rain expected Close the Awning
                                  Modules.WithName("Awning").Off();
                                  return false;
                                }
                              }
                              return true;
                            });
« Last Edit: June 05, 2015, 05:32:25 PM by mvdarend »

June 13, 2015, 09:11:11 AM
Reply #6

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
I've uploaded a final(?) version with the following changes:

- Obsolete functions replaced with new ones (AddOption, UseWidget, Option)
- Rain graph fits in the widget better
- Max. rain expected info.
- Legend showing colors/rainfall info
- Tooltip when hovering over graph (was in previous version, but I forgot to mention it)

June 19, 2015, 07:33:17 PM
Reply #7

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
The error trapping isn't very good, sometimes when there is an error or empty data the APP crashes. I'm testing a new version at the moment, I'll upload it in a couple of days (if it proves to be more stable.)

June 22, 2015, 02:01:39 PM
Reply #8

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
New version with better error handling.

July 08, 2015, 07:24:48 AM
Reply #9

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
Just uploaded another new version of the .hgx file, the previous one still crashed every now and again. This version has been running for over a week without issue.

July 20, 2015, 12:18:00 PM
Reply #10

NicoVermeir

  • ****
  • Information
  • Sr. Member
  • Posts: 122
    • My blog
can't seem to get this to work. I copied the files from the zip into the right folder, it shows up in the widget section but I can't get it to appear in the add module dialog. how do I add this to a group?

July 20, 2015, 01:11:49 PM
Reply #11

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
You have to put the widget zip files in the folder /usr/local/bin/homegenie/html/pages/control/widgets/Arend
For me in France that work.
Only I need to modify the line 50 by that code :
double RainThreshold = Program.Option("RainThreshold").DecimalValue;
Instead of I got Program Notify Error : CR Unknown And Red light for the program. I am running on Debian and Convert.ToDouble generate that error.
« Last Edit: July 20, 2015, 01:14:29 PM by dani »

July 20, 2015, 04:28:15 PM
Reply #12

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
can't seem to get this to work. I copied the files from the zip into the right folder, it shows up in the widget section but I can't get it to appear in the add module dialog. how do I add this to a group?
Does the imported .hgx file work, or are you seeing the same problem that Dani has?

If you can start the APP, and it gets a little green ball it should show up in the Add module dialog.

Dani, is it possible that you're running a different version of Mono? I'm running on a BananaPi, mono --version gives me this:
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
« Last Edit: July 20, 2015, 06:49:28 PM by mvdarend »

July 20, 2015, 10:02:11 PM
Reply #13

dani

  • *****
  • Information
  • Global Moderator
  • Posts: 535
My mono version :
Mono JIT compiler version 4.0.1 (tarball Tue May 12 15:39:23 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
« Last Edit: July 20, 2015, 10:04:25 PM by dani »

July 20, 2015, 10:22:17 PM
Reply #14

NicoVermeir

  • ****
  • Information
  • Sr. Member
  • Posts: 122
    • My blog
can't seem to get this to work. I copied the files from the zip into the right folder, it shows up in the widget section but I can't get it to appear in the add module dialog. how do I add this to a group?
Does the imported .hgx file work, or are you seeing the same problem that Dani has?

If you can start the APP, and it gets a little green ball it should show up in the Add module dialog.

Dani, is it possible that you're running a different version of Mono? I'm running on a BananaPi, mono --version gives me this:
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)

I tried the hgx, didn't seem to do anything. I then copied the files from the zip into the folder, now the widget shows up but when I try to run / preview it I get "TypeError: Unable to get property 'Name' of undefined or null reference
Line 27, Column 5"