The Vera Community forums have moved!

Advanced => Programming => Plugins & Plugin Development => Topic started by: blakem on April 10, 2014, 08:16:48 pm

Title: Virtual Rain Sensor
Post by: blakem on April 10, 2014, 08:16:48 pm
Description
The Virtual Rain Sensor is a device that activates or trips when it has rained or will rain.  It does this by retrieving the past and future precipitation(rain, snow, sleet & hail) total for each day over a defined window of time and comparing the total to an adjustable threshold.  When the threshold is exceeded the device will change state to "tripped" indicating that rain is detected.  The intended application of this device is for suspending an automatic irrigation system when it has or will rain.  The threshold value ensures that the irrigation will not be bypassed for instances of light rain and aims to maintain a minimum amount of moisture at the given location.  For forecasted precipitation this device compares the Quantitative Precipitation Forecast(QPF) or the user may choose the Probability of Precipitation(PoP).  A free account with the Weather Underground API is required for this plugin to operate. If you do not already have a key which is used for the weather plugin then follow instructions below.

Requirements\Limitations

Version History


Weather Underground API Key Sign Up
You must obtain a free key for the Weather Underground API before you can use this plugin.  If you already have a key setup with the Weather plugin then you may use that key for both plugins.


Installation
http://apps.mios.com/plugin.php?id=6366 (http://apps.mios.com/plugin.php?id=6366)


API Requests
The Weather Underground API developer key only allows 500 calls per day and no more than 10 calls in one minute.  Use these equations below to calculate the number of requests this plugin will generate.  Note that it is not possible to exceed either one of these conditions with this plugin alone.
Maximum API requests in 1 min: = 1 + (daysInPast - 1)
Minimum API requests in 1 day: = ( 24 hours / hoursBetweenUpdate ) + daysInPast - 1

Icon State
Grey Raindrop: No rain detected, "Not tripped", total precipitation below threshold
Blue Raindrop: Rain detected, "Tripped", total precipitation above threshold


Variables
urn:upnp-org:serviceId:VRainSensor
   Inputs
   Key: Weather Underground API key
   Location: Site to monitor precipitation, formats may be "lat,long" or 5-digit zip code
   MetricUnits(0 or 1): Sets metric or english units, "1" for metric units and "0" for english units
   DaysInPast(0-8): Number of days in the past, including today, to add the accumulated precipitation in the total
   DaysInFuture(0-8): Number of days in the future, including today, to add the forecasted precipitation in the total
   Threshold: Value to determine tripped state from precipitation total, in units of inches or millimeters
   HoursBetweenUpdate(1-12): Number of hours until the next update will occur
   LandscapeCoefficient(0-1.2): Evapotranspiration crop coefficient sets the water demand of plants in landscape (0=Use fixed threshold)
   LowTempCutoff: Temperature threshold in Celsius or Fahrenheit that the "Tripped" state occurs when the current temperature falls below
   PoPThreshold(0-100): Percentage of PoP that will trigger the "Tripped" state (0=Use QPF instead of PoP)

   Outputs
   PrecipitationTotal: Total amount of precipitation over the defined past and future days
   ForecastedPrecip: CSV(Comma Separated Value) string of the QPF(Quantitative Precipitation Forecast) for each day
   PastPrecip: CSV string of the precipitation total for each day in the past
   ProbabilityOfPrecip: CSV string of the probability of precipitation for each day
   TodaysDate: Current date in format 'MM/DD/YYYY'
   DataSource: Weather Underground Station id used to get accumulated precipitation(past and present)
   PastEvapotranspiration: CSV string of the evapotranspiration for each day in the past
   FutureEvapotranspiration: CSV string of the evapotranspiration for each day in the future

urn:micasaverde-com:serviceId:SecuritySensor1
   Armed: Armed state of the device, "1" for armed and "0" for bypassed
   Tripped: Tripped state of the device, "1" for precip total above threshold and "0" for precip total below threshold
   LastTrip: Unix epoch time when "Tripped" last transitioned from "0" to "1"

urn:micasaverde-com:serviceId:HaDevice1
   LastUpdate: Unix epoch time when data and tripped state last updated


Triggers
Since version 3.0 there are 3 different trigger options. These are OR logic so it only requires one condition to be true for the sensor to trip to a "1" state and all conditions must be false for it to reset to "0" state.

  1. Total Precipitation Threshold
    1a. Fixed amount - A constant threshold that does not change over time
    1b. Evapotranspiration - Threshold is continually set equal to the total evapotranspiration for the given period. The Evapotranspiration landscape coefficient allows for adjusting to various types of crops/plants that have different amount of water demands.
  2. Forecast Method - There are two modes; When QPF is selected the QPF is added to the total precipitation and PoP is ignored.  When a PoP threshold is selected then QPF is ignored and the forecast is triggered by only PoP.
  3. Low Temp Cutoff - Threshold where the sensor will trip to a "1" state when the current temperature drops below the threshold.


Settings
The following table shows the relationships between the length of the window(number of days in the past and future) and the level of the threshold.

Short Window, Low Threshold:  Sensitive to small amounts of rain in one day(quick to set, quick to reset)
Short Window, High Threshold: Sensitive to large amounts of rain in one day(quick to set, quick to reset)
Long Window, Low Threshold:   Sensitive to small amounts of rain in one day(quick to set, slow to reset)
Long Window, High Threshold:  Sensitive to small amounts of rain over several days(slow to set, quick to reset) or a large amount of rain in one day(quick to set, slow to reset)

One caution I would add about choosing settings is the potential for the sensor to remain tripped when there is rain potential that is over the threshold reoccurring for several days, but there is actually no or little rainfall.  Logic could be added to escape this condition, but for now I would just like to see if it is really necessary.  Setting a high enough threshold and a shorter forecast window should minimize the condition from occurring.


Usage In Scene
Add a trigger and choose the Virtual Rain Sensor device

A sensor is tripped
   Device is tripped: fired when total precipitation above threshold
   Device is not tripped: fired when total precipitation below threshold

An armed sensor is tripped
   Device armed is tripped: fired when armed and total precipitation above threshold
   Device armed is not tripped: fired when armed and total precipitation below threshold


Usage In Luup Code
Here are some Luup code examples to display possible uses.  In each example the device number is assumed to be 99 and will need to be changed to your device number.  These are just examples so other parameters may need to be tweaked to fit your needs.

Input Examples
Code: [Select]
--Arm
luup.call_action("urn:micasaverde-com:serviceId:SecuritySensor1", "SetArmed", {newArmedValue="1"}, 99)

--Bypass
luup.call_action("urn:micasaverde-com:serviceId:SecuritySensor1", "SetArmed", {newArmedValue="0"}, 99)

--Force an update of the forecast
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "Update", {}, 99)

--Change to english units
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetMetric", {newMetricValue="0"}, 99)

--Change to metric units
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetMetric", {newMetricValue="1"}, 99)

--Change the weather underground API key to use "abcd1234"
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetKey", {newKeyValue="abcd1234"}, 99)

--Change location to use zipcode "12345"
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetLocation", {newLocationValue="12345"}, 99)

--Change the number of days to look in the past(including today) to 5
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetDaysInPast", {newDaysInPastValue="5"}, 99)

--Change the number of days to look in the future(including today) to 4
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetDaysInFuture", {newDaysInFutureValue="4"}, 99)

--Change the total precipitation threshold to 0.56
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetThreshold", {newThresholdValue="0.56"}, 99)

--Change the update interval to 6 hours
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetHoursBetweenUpdate", {newHoursBetweenUpdateValue="6"}, 99)

--Change the landscape coefficient to 0.6 (will also change to variable threshold)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetLandscapeCoefficient", {newLandscapeCoefficientValue="0.6"}, 99)

--Change the landscape coefficient to 0 (will also change to fixed threshold)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetLandscapeCoefficient", {newLandscapeCoefficientValue="0"}, 99)

--Change the Probability of precipitation threshold to 60% (will stop using QPF for forecasted rain)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetPoPThreshold", {newPoPThresholdValue="60"}, 99)

--Change the Probability of precipitation threshold to 0% (will start using QPF for forecasted rain)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetPoPThreshold", {newPoPThresholdValue="0"}, 99)

--Change the low temperature cutoff to -10 degrees
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "SetLowTempCutoff", {newLowTempCutoffValue="-10"}, 99)


Output Examples
1. Make decision based on rain or no rain detected
Code: [Select]
--Force update(this step optional)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "Update", {}, 99)

--Get current state
local tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped", 99)

if tripped == "0" then
  --Do not tripped logic here
  --Precipitation not detected, total precipitation below threshold
end

if tripped == "1" then
  --Do tripped logic here
  --Precipitation detected, total precipitation above threshold
end

2. Retrieve total precipitaion
Code: [Select]
--Get total precipitation in past and future
local precipitationTotal = luup.variable_get("urn:upnp-org:serviceId:VRainSensor","PrecipitationTotal", 99)

3. Create a lua table containing the precipitation for each day in the past
Code: [Select]
--Convert CSV string to a lua table(
function csvToTable(csvString)
   local t={}
   local i=1

   for str in string.gmatch(csvString, "([^, ]+)") do
      t[i] = str
      i = i + 1
   end

   return t
end

--Assume device id of Virtual Rain Sensor is 99
local deviceId = 99

--Get past precipitation as CSV string
local pastPrecipCSV = luup.variable_get("urn:upnp-org:serviceId:VRainSensor","PastPrecip",deviceId)

--Convert CSV string to a lua table
local pastPrecipTable = csvToTable(pastPrecipCSV)

--Number of elements in table
local tableSize = #pastPrecipTable

for day = 1, tableSize do
   --Get past precip for each day
   local precipForOneDay = pastPrecipTable[day]
end
Title: Re: Virtual Rain Sensor
Post by: RexBeckett on April 11, 2014, 04:00:23 am
That is a really comprehensive and well-written set of instructions. Good work, @blakem.

You may want to add instructions for manually installing the icon files while you wait for it to arrive in the App store.
 
Title: Re: Virtual Rain Sensor
Post by: sjolshagen on April 11, 2014, 11:55:39 am
Possibly a stupid question, but what happens for locations that have frozen precipitation (snow, sleet, ice)?
Title: Re: Virtual Rain Sensor
Post by: RichardTSchaefer on April 11, 2014, 02:25:56 pm
You might want to discuss what happens with people that use the Weather Underground plugin ...

Can you obtain 2 keys per user ? One for each app ?

You might also want to comment on using the Same API key for the Weather Underground plugin ... or better yet ... search for it and grab it's key if it's already installed.
How often do you Poll ... If they use the same key ... the total needs to be within the Fee App Limit specs.



Title: Re: Virtual Rain Sensor
Post by: blakem on April 11, 2014, 09:02:54 pm
@sjolshagen, that is a good question and in short yes it does include the melted equivalent.  The fields I am getting from the API are of the precipitation totals for the given day.  The definition of precipitation is of all the forms of fallen water as you described so I believed it did include the melted snow equivalent.  I just pulled up some data from days earlier this year and sure enough every day there is snow, there is about 10 to 20 times less precipitation which is about the melted equivalent so I am confident that yes snow and sleet are included in the calculation.

@RichardTSchaefer, I really appreciate your reply.  I should have mentioned more about the potential conflicts.  I limited the amount of days in the past to avoid any issue but if you poll every 30 seconds or less with the weather plugin(2 calls or more per minute) and set the Virtual Rain Sensor to the maximum 8 days and do a reload, then you will create 11 calls in one minute which is over the maximum of 10 calls in one minute.  I am going to work on my code some to reduce my calls by 1 by combining the current day precipitation update and forecast update into one call which is possible by the API.  It is too bad you cannot access the same feature(history) more than once in a single call, but at least I can do the forecast and history together.

It would be possible to search for the weather plugin and copy the key on install to make it simpler but I was not sure that was a good idea or not.  What do you think?

Also it is possible to signup for a second API key with another email.  That is what I did when creating the instructions.
Title: Re: Virtual Rain Sensor
Post by: blakem on April 24, 2014, 04:13:43 pm
Version 2.1 is now available for download in the OP.  A settings tab was added which simplifies the initial setup along with changes to the way the system calls the updates periodically.  Enjoy!
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on April 24, 2014, 09:25:51 pm
Nice plugin.

Has anyone else reported (last version) the device report Lua errors?

I'm running this on a test vera lite with only a few other apps installed, UI5.

Title: Re: Virtual Rain Sensor
Post by: blakem on April 24, 2014, 10:53:01 pm
@Bulldoglowell, I designed it so if there are 5 consecutive communication failures it will set the device into failure.  The idea was to notify the user that it is not updating.  In the latest version 2.1 I write errors to the task status bar on the UI so that feature is not really that important now.  If it becomes a nuisance it could be removed easily.  In any case if the communication issue resolves itself then the plugin will continue to function again even though it shows a device failure.  A reload will clear the failure flag.

Also worth noting there were some quirks with version 1.0 that are now resolved with version 2.1 that could have caused the device failure to report needlessly.  It should be a nonissue now but please let me know of any problems you might have with the latest.
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on April 24, 2014, 11:09:12 pm
Right then, thanks for the quick response. I'll update it when I get the chance and let you know.

Cheers.
Title: Re: Virtual Rain Sensor
Post by: Faber Optime on April 25, 2014, 11:20:56 am
Top idea, kudos and appreciation for the work!  :D
Unfortunately I'm not able to get it working though. :(
On all settings for historic precipitation other than None, I'm running into error at every reload:
VRainSensor : Error!, precip section not found in history data.
Device is not showing any rain drop icon (never has, despite uploading the (27bytes, really?) "icon" (.png, but unreadable) files to directory as specified in OP.
If I change historic setting to None, runs without error, but despite that, still haven't managed to see it working.
Title: Re: Virtual Rain Sensor
Post by: Sender on April 25, 2014, 01:39:14 pm
Hi,

installed plugin succesfully. Created account and generated API key. But the plugin wont save my configuration and API key.

Vera keeps saying: VRainSensor : Enter API Key on Device Settings Tab

Do I need to save in a special way?

EDIT: There is a "hidden" button you can go there with "TAB"... its on the configure page...
Title: Re: Virtual Rain Sensor
Post by: blakem on April 25, 2014, 03:55:32 pm
Top idea, kudos and appreciation for the work!  :D
Unfortunately I'm not able to get it working though. :(
On all settings for historic precipitation other than None, I'm running into error at every reload:
VRainSensor : Error!, precip section not found in history data.
Device is not showing any rain drop icon (never has, despite uploading the (27bytes, really?) "icon" (.png, but unreadable) files to directory as specified in OP.
If I change historic setting to None, runs without error, but despite that, still haven't managed to see it working.
Thank you for your reply and sorry for being on the front end of testing. :) I believe what is happening is a conflict between your system time zone and the time zone of the location you selected.  Is your Vera system time set properly for your time zone(shown in top right corner)? What are you using as your location?  You can private message it to me if you don't want to post it.  For now you are limited to those two time zones being the same.  In short the plugin is requesting precipitation data on a day that does not exist yet.

For the icons, if you manually uploaded them in the "Luup files" section that will not work.  Honestly the best thing to do now since the plugin got approved is go into the app store and install the plugin.  Then the icons will be loaded in the right place.

EDIT: Ok looking at it closer it looks like some locations do not have precipitation available since there are no weather stations reporting precipitation nearby.  I have found some locations outside the united states where there is no precipitation so maybe that is actually your case.  If you post your location I can look it up.
Hi,

installed plugin succesfully. Created account and generated API key. But the plugin wont save my configuration and API key.

Vera keeps saying: VRainSensor : Enter API Key on Device Settings Tab

Do I need to save in a special way?

EDIT: There is a "hidden" button you can go there with "TAB"... its on the configure page...
Glad you got it to work and thank you for letting me know about the button not showing properly.  What browser are you using by the way? Are you using Vera UI5?  I think this will be a simple change to the CSS in the HTML to fix.  Also the settings tab should look like the image attached to the first post.
Title: Re: Virtual Rain Sensor
Post by: Sender on April 25, 2014, 04:03:52 pm
Ui5 and chrome
Title: Re: Virtual Rain Sensor
Post by: blakem on April 25, 2014, 05:35:42 pm
Ui5 and chrome
Thanks, I installed Chrome and duplicated the problem.  It will be fixed in the next release.  I just removed the style so it will just look like a plain button now, but hey you can see it. ;)
Title: Re: Virtual Rain Sensor
Post by: Sender on April 26, 2014, 01:39:23 am
Thanx!
Title: Re: Virtual Rain Sensor
Post by: AgileHumor on April 26, 2014, 01:05:08 pm
Great plugin idea!
Title: Re: Virtual Rain Sensor
Post by: Faber Optime on April 26, 2014, 05:14:20 pm
Thank you for your reply and sorry for being on the front end of testing. :)
No probs good sir, thank you for your ongoing, sterling work! :)

Pleased to report that with your kind assist, have made progress and seem to have successfully achieved working sensor - just awaiting the essential real life local rain to further explore...  ::)

In feedback:

Thanks again for the great work mate.
Title: Re: Virtual Rain Sensor
Post by: mda on April 27, 2014, 05:07:09 am
@blakem I uninstalled and deleted all files from the manually installed version then installed and configured the plugin from the App Store. It seemed ok for a few hours, but now I am getting this error:

VRainSensor : Error!, summary section not found in history data.

Please let me know if there is anything I can do to help figure out what the issue is. Thanks!


Sent from my iPhone using Tapatalk
Title: Re: Virtual Rain Sensor
Post by: blakem on April 27, 2014, 08:20:24 am
@faberoptime, thank you for posting your solution.  It did shed some light on the way that weather underground forms their database.  It looks like personal weather stations only have hourly observations available in the history and no daily summary.  I need to add changes to the plugin to look at these observations when the summary is not available.

Also I looked into your case and it appears that the 2 airports near you do not report precipitation.  In your case, using the latitude and longitude for the location will probably never show anything other than 0 precipitation until I fix the plugin and you use your personal weather station for the location.

@mda, what is the location you are using?  I assume it will be the same issue that faberoptime is experiencing but it may be different.
Title: Re: Virtual Rain Sensor
Post by: mda on April 27, 2014, 02:39:51 pm
@blakem - i sent you a PM. thanks!
Title: Re: Virtual Rain Sensor
Post by: destinet on April 29, 2014, 01:43:18 pm
Any idea of how this is usefull? Try to think but can't find a way to use it:(
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on April 29, 2014, 02:30:13 pm
you can affect your irrigation controller.

e.g. if it rained yesterday, don't need to water today.
Title: Re: Virtual Rain Sensor
Post by: blakem on April 29, 2014, 05:13:23 pm
Any idea of how this is usefull? Try to think but can't find a way to use it:(
It was developed to suspend the automatic schedule of an irrigation system, but I am sure there could be many more applications. 

To use it add a trigger for a scene when the "Tripped" device variable is a value of "1" meaning it has or will rain or a value of "0" when there is no rain.

You could also use it just like a basic rain gauge by reading the "PrecipitationTotal" device variable.  For instance if you set the accumulated precipitation period to today only and the forecast to none.  You can get the total amount of precipitation that has fallen for today.
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on April 30, 2014, 10:23:50 pm
@Bulldoglowell, I designed it so if there are 5 consecutive communication failures it will set the device into failure.  The idea was to notify the user that it is not updating.  In the latest version 2.1 I write errors to the task status bar on the UI so that feature is not really that important now.  If it becomes a nuisance it could be removed easily.  In any case if the communication issue resolves itself then the plugin will continue to function again even though it shows a device failure.  A reload will clear the failure flag.

Also worth noting there were some quirks with version 1.0 that are now resolved with version 2.1 that could have caused the device failure to report needlessly.  It should be a nonissue now but please let me know of any problems you might have with the latest.

The 5 inches of rain today reminded me to let you know all is working very well...

Again, great little plugin,  I feel bad having to tear out all that Lua and PLEG I cobbled together to do what your plugin does so elegantly. :)
Title: Re: Virtual Rain Sensor
Post by: Faber Optime on May 02, 2014, 05:56:40 pm
Apologies for the delayed reply - adventures elsewhere have kept me busy.
From the read of your latest update to original post, sounds like v2.4 may be cure for my ills - kudos for the rapid updates!
That said, looks like I'm awaiting this to be propagated via Via App update?
I'm presently still stuck on V2.2 and reinstalling showed Install Apps list still advertising v2.2 as well. :(
Say I don't suppose that you'd be prepared to attach most recent version's files to this thread to enable eager beavers such as I to do a manual, interim update prior to App being automatically updated? :)
Thanks again for all the valuable, ongoing work.

p.s. FYI my continuing testing concurs with your stated findings on my and other cases.
Title: Re: Virtual Rain Sensor
Post by: blakem on May 02, 2014, 07:20:29 pm
The 5 inches of rain today reminded me to let you know all is working very well...

Again, great little plugin,  I feel bad having to tear out all that Lua and PLEG I cobbled together to do what your plugin does so elegantly. :)

Wow 5 inches, that is substantial. 

Thank you, I am glad someone else could use it.  Actually I thought what you had seemed to work good, but for me I would have always wondered if it would have set when it really never rained or rained very little.

Apologies for the delayed reply - adventures elsewhere have kept me busy.
From the read of your latest update to original post, sounds like v2.4 may be cure for my ills - kudos for the rapid updates!
That said, looks like I'm awaiting this to be propagated via Via App update?
I'm presently still stuck on V2.2 and reinstalling showed Install Apps list still advertising v2.2 as well. :(
Say I don't suppose that you'd be prepared to attach most recent version's files to this thread to enable eager beavers such as I to do a manual, interim update prior to App being automatically updated? :)
Thanks again for all the valuable, ongoing work.

p.s. FYI my continuing testing concurs with your stated findings on my and other cases.

Thank you for identifying the problem with personal weather stations.  It turns out that when I called the history before it would always get the data from the nearest airport but now with v2.4 it uses the history from the station that the weather underground api returned for the current conditions.  This way the api determines the source of the history data.  I currently enter the lat long of my house and it should now get the data from the nearest weather station that is online.

One thing that I found during testing is sometimes personal weather stations go offline for a day.  In that case you will see a "N/A" for not available.

I used your location for one of my test cases and it worked with no problems.  I also did not have to adjust any clocks for the time zone difference.  The date is now completely driven by the weather location.

EDIT: Version 2.4 available in app store so attachment removed.
Title: Re: Virtual Rain Sensor
Post by: Faber Optime on May 04, 2014, 03:01:59 am
The 5 inches of rain today reminded me to let you know all is working very well...

Again, great little plugin,  I feel bad having to tear out all that Lua and PLEG I cobbled together to do what your plugin does so elegantly. :)

Wow 5 inches, that is substantial. 

Thank you, I am glad someone else could use it.  Actually I thought what you had seemed to work good, but for me I would have always wondered if it would have set when it really never rained or rained very little.

Apologies for the delayed reply - adventures elsewhere have kept me busy.
From the read of your latest update to original post, sounds like v2.4 may be cure for my ills - kudos for the rapid updates!
That said, looks like I'm awaiting this to be propagated via Via App update?
I'm presently still stuck on V2.2 and reinstalling showed Install Apps list still advertising v2.2 as well. :(
Say I don't suppose that you'd be prepared to attach most recent version's files to this thread to enable eager beavers such as I to do a manual, interim update prior to App being automatically updated? :)
Thanks again for all the valuable, ongoing work.

p.s. FYI my continuing testing concurs with your stated findings on my and other cases.

Thank you for identifying the problem with personal weather stations.  It turns out that when I called the history before it would always get the data from the nearest airport but now with v2.4 it uses the history from the station that the weather underground api returned for the current conditions.  This way the api determines the source of the history data.  I currently enter the lat long of my house and it should now get the data from the nearest weather station that is online.

One thing that I found during testing is sometimes personal weather stations go offline for a day.  In that case you will see a "N/A" for not available.

I used your location for one of my test cases and it worked with no problems.  I also did not have to adjust any clocks for the time zone difference.  The date is now completely driven by the weather location.

I attached the files that changed in V2.4 so install the V2.2 plugin in the app store then manually upload these 3 files.  This way it can be automatically updated in the future.  I will remove these files once the new version is approved in the app store.  Let me know how it works.  There may be more issues.

Installed fresh v2.2 sensor via app store then uploaded the three files to Vera - no worries.
WUnderground plugin details correctly pulled over (although not units?), anyhow with no error, plugin had apparently behaved as expected, with valid data shown on data tab and pws noted as source. Sweet!  ;D

So looking good and now awaiting rain. :)

Thanks again for all the work good sir!
Title: Re: Virtual Rain Sensor
Post by: Faber Optime on May 09, 2014, 05:19:42 am
Just wanted to report back that v2.4 has been working flawlessly for me just as advertised for days now. Although have only checked it irregularly, have seen both triggered when raining, untriggered latterly and triggered again on a different occasion.
Changing config and update has been working without problem and haven't seen a lua error reported since (v2.4) installation through multiple reboots.

Now a great, functional complement to the WUnderground plugin.

Top banana blakem ;D
Title: Re: Virtual Rain Sensor
Post by: Freddan101 on May 10, 2014, 01:26:41 am
Would it make sense to add the past/current/forecast tempterature to the formula to indicate if watering is needed?
Title: Re: Virtual Rain Sensor
Post by: theal on May 12, 2014, 11:08:30 am
Awesome plugin and thanks for forecast fast fix with v.2.5!

Few suggestions on future development:
- display values in Dashboard plugin interface: total, past & forecast, last pull time
- pull and display all available days, not just threshold days
- separate parameter for each day (.., d-2,d-1,d0,d1,..)
- probability for each forecast day
- multiple stations/plug-ins for averaging/failover between two/several stations

Thanks again!
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on May 12, 2014, 12:39:35 pm
Would it make sense to add the past/current/forecast tempterature to the formula to indicate if watering is needed?

it took me a while,but finally got what you meant,  In SoFla where (HOT therefore RAIN) is the norm, I was in the wrong paradigm.   Extended hot weather without rain... may need to add a watering cycle that otherwise you may not do.

you could use PLEG to do that for you; eg. if it records a sensor's temperature over 90F for the past three days, and today is Wednesday, water today instead of thursday.

Title: Re: Virtual Rain Sensor
Post by: Freddan101 on May 12, 2014, 02:21:38 pm
Yes, PLEG would work for that. I see a scenario where it hasn't rained for 3 days but max temp has only been 10C. Probably watering is not needed.
Title: Re: Virtual Rain Sensor
Post by: blakem on May 12, 2014, 08:29:05 pm
Would it make sense to add the past/current/forecast tempterature to the formula to indicate if watering is needed?

Yes it would, but it is unfortunately not that simple.  Equations for calculating evaporation are functions of not only temperature, but wind, humidity and solar radiation.  The agriculture sciences have come up with some nice guides on all of these calculations and I started off studying them before making this plugin.  In the end I figured I would just keep it simple by only limiting the number of days that I would look at and the moving window would sort of solve the evaporation problem.  While it is not perfect I feel it does do an "ok" job at creating a method in the majority of cases to limit irrigation during periods of rain.

In the end you need to know not only how much precipitation falls, but also how much runs off before it is absorbed in the ground.  Also some water pools up on the ground and evaporates at a higher rate than what gets absorbed below the surface.  Another loss is transpiration of the grass itself, but most group evaporation and transpiration together and call it evapotranspiration.

In the end I might look at adding an option to calculate evapotranspiration so it will essentially reduce the total precipitation over time, which might possibly drop below the threshold.  That way you can set a longer period of time and it will better model natural evaporation like a real physical rain sensor.  It also could work the opposite way and evaporate more quickly in hot weather which would also be desirable.
Title: Re: Virtual Rain Sensor
Post by: AgileHumor on May 12, 2014, 08:34:18 pm
This plugin is amazing.  Thanks BlakeM!
Title: Re: Virtual Rain Sensor
Post by: blakem on May 12, 2014, 08:49:22 pm
Awesome plugin and thanks for forecast fast fix with v.2.5!

Few suggestions on future development:
- display values in Dashboard plugin interface: total, past & forecast, last pull time
I had thought about that before, but has not been a priority yet.  I went ahead and added the total precipitation to the dashboard and will put it in the next release, but I am not sure there is room to put really any more info without crowding it up.

- pull and display all available days, not just threshold days
Not sure exactly what you mean, but I assume you mean display the data for 7 days past and future but only compare to the number set on the settings tab.  It could be done, but it would be a big change.  Also there is a separate request for each day in the past.  With the option to select the number it does give the option of how many requests to generate.  Not sure everyone will want it to create that many.

- separate parameter for each day (.., d-2,d-1,d0,d1,..)
I tried to keep the number of device state variables used to a minimum, but if there is a need to export the data in that form then it could be possible.  Right now with a little lua/luup code you can get each individual day from the CSV string.

- probability for each forecast day
I don't think this would be very helpful.  I used the QPF since it gives the magnitude of the precipitation, but the PoP has no magnitude.  It just states the probability that greater than 0.01" of rain will fall within the predicted period.  So it basically tells the certainty, but lacks the amount which is what in this application I think you would want to know.  I had thought about multiplying the QPF and the PoP together to give the forecast a weighted value of certainty but I don't know if that would even make any sense to do that.  It was just a thought on how to have a more optimistic approach.

- multiple stations/plug-ins for averaging/failover between two/several stations
This can already sort of be done now by entering your location by lat long or zip code.  It will choose the nearest station online.  It is an interesting idea on the possibility of extrapolation by triangulation of multiple stations nearby.  It would definitely increase the complexity but should be possible.
Title: Re: Virtual Rain Sensor
Post by: thebgrian on May 13, 2014, 11:51:01 pm
Hi, blakem
Thank you for the great plugin. It's a must for automation of sprinkler systems.
I have a data problem- the first day on which I installed the plugin is showing for Accumulated Precipitation Tue, 5/13 -999.00, Mon, 5/12    T Sun, 5/11 T,  for Forecasted Precipitation - Tue, 5/13 0.27   Wed, 5/14 0, for Total Precipitation -998.73.
It will take a big flood to get me over the limit of 0.1 I have set :)
Is there  way to fix the -999.00 precipitation I have showing for Tue, 5/13?
Title: Re: Virtual Rain Sensor
Post by: theal on May 14, 2014, 01:43:15 pm
BlakeM,

I went ahead and added the total precipitation to the dashboard and will put it in the next release, but I am not sure there is room to put really any more info without crowding it up.

Thank you!

there is a separate request for each day in the past.

How about display ALL future days since it's one call?
I found it extremely useful to have a quick view of week-ahead for my activity schedule.
I see a lot of uses for your plugin beyond just irrigation controller.


I tried to keep the number of device state variables used to a minimum, but if there is a need to export the data in that form then it could be possible.  Right now with a little lua/luup code you can get each individual day from the CSV string.

My major goal (along with water conservation) is to avoid run-offs by drying soil prior and after large rainfall, so I would need to look at future and past days separately.  Also it would be nice to have ability for a single day threshold alarm.
I have not master lua/luup code yet. Do you have an example how to get each individual day from the CSV string? Is it 'ForecastedPrecip[d#]?
Perhaps you can share your irrigation control logic.

Btw, how does Today's forecast reported? Is it for total 24 hours or for remaining of the day?

I don't think this would be very helpful.  I used the QPF since it gives the magnitude of the precipitation, but the PoP has no magnitude.  It just states the probability that greater than 0.01" of rain will fall within the predicted period.  So it basically tells the certainty, but lacks the amount which is what in this application I think you would want to know.  I had thought about multiplying the QPF and the PoP together to give the forecast a weighted value of certainty but I don't know if that would even make any sense to do that.  It was just a thought on how to have a more optimistic approach.

Thanks for clarification. I thought of multiplying the QPF and the PoP too. I still think probability would be helpful, for example, if POP under some threshold, I can ignore QPF for that day.  If not for irrigation, it would be helpful for activity planing.

This can already sort of be done now by entering your location by lat long or zip code.  It will choose the nearest station online. 

Some stations may be missing past rainfall or may not report forecast.  Does station selection account for this?
I do see big discrepancy between my three station in 5 mile radius so averaging would be good.

Thanks again for great work!
Title: Re: Virtual Rain Sensor
Post by: blakem on May 14, 2014, 04:09:50 pm
Hi, blakem
Thank you for the great plugin. It's a must for automation of sprinkler systems.
I have a data problem- the first day on which I installed the plugin is showing for Accumulated Precipitation Tue, 5/13 -999.00, Mon, 5/12    T Sun, 5/11 T,  for Forecasted Precipitation - Tue, 5/13 0.27   Wed, 5/14 0, for Total Precipitation -998.73.
It will take a big flood to get me over the limit of 0.1 I have set :)
Is there  way to fix the -999.00 precipitation I have showing for Tue, 5/13?

Thank you for reporting the problem.  I have just fixed it so today's precipitation value will show "T" for trace amount when the value is negative.  It should be in the next release.  It was working on past days but not the current day.  Unfortunately that only fixes part of the problem so that you won't see a negative total precipitation. 

The other problem is I think that weather station might need service unless there really has been trace amounts of rain for the last several days.  Go to the "Data" tab on the plugin and click on the station name in the bottom right corner to look at what values it is showing on Weather Underground.  On that webpage you can also click the "change station" link at the top of the webpage to display other nearby station names.  You can manually enter the 4 letter airport code or a personal weather station name starting with "pws:" for the location to force the plugin to use a different station.

BTW which station name is displayed on the data tab so I can investigate it just incase there is something else going on.
Title: Re: Virtual Rain Sensor
Post by: thebgrian on May 14, 2014, 05:41:48 pm
Thank you, Blakem

You are right, the station that I got based on the zip code ( KTXTHECO9 ) is not reporting precipitation data. After changing the station I'm getting more acceptable readings.
Title: Re: Virtual Rain Sensor
Post by: blakem on May 15, 2014, 08:06:55 pm
Do you have an example how to get each individual day from the CSV string? Is it 'ForecastedPrecip[d#]?

Here is an example that will create a table in lua containing the daily precipitation values.  This is just one example and I am sure there are many ways to accomplish the same thing.
Code: [Select]
function csvToTable(csvString)
   local t={}
   local i=1

   for str in string.gmatch(csvString, "([^, ]+)") do
      t[i] = str
      i = i + 1
   end

   return t
end

--Assume device id of Virtual Rain Sensor is 99
local deviceId = 99

--Get past precipitation as CSV string
local pastPrecipCSV = luup.variable_get("urn:upnp-org:serviceId:VRainSensor","PastPrecip",deviceId)

--Convert CSV string to a lua table
local pastPrecipTable = csvToTable(pastPrecipCSV)

--Number of elements in table
local tableSize = #pastPrecipTable

for day = 1, tableSize do
   --Get past precip for each day
   --pastPrecipTable[day]
end

Btw, how does Today's forecast reported? Is it for total 24 hours or for remaining of the day?
Well before the API changed, it would forecast QPF for a full 24 hour period.  That made it very simple so I could just take the max value of the accumulated precipitation and forecast precipitation for the current day since the time periods overlapped exactly.  Now the forecasted precipitation is only for the time remaining in the day so it is just added to the total.  I don't think this is quite as good but it is what I got.  I actually found I could opt not to use this new best forecast and use the old method, but I am sure the new model is more accurate so it will probably be better in the way of accuracy.

Thanks for clarification. I thought of multiplying the QPF and the PoP too. I still think probability would be helpful, for example, if POP under some threshold, I can ignore QPF for that day.  If not for irrigation, it would be helpful for activity planing.
I have thought quite a bit about how to improve the rain detected decision for forecasted precipitation, but after you posted this I looked some more and found something that does make a little sense.  As stated before I don't think the PoP alone is what you are interested in and the QPF alone only gives the total potential without any certainty.  With a little math you can determine the PQPF(Probabilistic Quantitative Precipitation Forecasting) from both the PoP and QPF.  This combined approach will give the probability that a rain total of a given amount will occur.  This way you could make the decision it will rain when the probability that 0.25in or greater of rain will fall is over a 50% chance.  You would still need these two values of the precipitation amount to exceed and percentage threshold to trigger rain condition, but this is the only other way that makes sense to me.  For right now though I think I will leave it the way it is since it is quite simple how it works now.  If I add this logic in the future I will make it an option to use the probabilistic approach or simply add the QPF to the total just like it does right now.

An article describing this type of analysis.
http://www.srh.noaa.gov/tsa/?n=pqpf_explaination (http://www.srh.noaa.gov/tsa/?n=pqpf_explaination)

Some stations may be missing past rainfall or may not report forecast.  Does station selection account for this?
I do see big discrepancy between my three station in 5 mile radius so averaging would be good.
No it does not.  The API actually decides the closest station.  It may be possible to add logic to check for this in the future, but I would have to know what to be checking.  All I can say is pick the best one you think is the most reliable.  In my location I have several weather stations within a few miles and I do see differences, but it from the type of isolated storms that move through here.  I have seen nearly an inch on one station and just a few hundredths on another only 2 miles away.  I verified with radar data that the other site was right on the edge of the line of storms as it moved through so that is one reason this plugin will not always be 100% accurate unless the weather station is in your backyard.  I personally have not seen any trend that one station is more biased, at least not for the amount of precipitation, but I am sure it is possible.  I have seen that some stations do become unavailable from time to time. 

In the case that a station was offline in the past then it will display "N/A" for that day.  If there was rain that day it will just not be included in the total.  So it may show no rain when there really was rain.  From a water conservation point of view it might be a little wasteful, but not critical in my view.  My worry is a case where it detects rain and when there is not sufficient rain causing it to suspend irrigation when it shouldn't.
Title: Future Development
Post by: blakem on May 15, 2014, 08:44:26 pm
Right now I am currently looking into adding an evapotranspiration estimate model to the plugin.  Thank you to Freddan101 for raising up the issue.

While researching it looks like a lot of people are using evapotranspiration estimates to determine the water needs of their crops, plants and trees.  Ideally you would take the total amount of rain and irrigation water in and balance the equation with the water needs determined by the evapotranspiration estimate.  In the case of this plugin there is no way to balance the water in and water out equation completely since it does not know how much water is added by irrigation.  What it can do is subtract away the precipitation lost due to evaporation and used by the plants.

So when it is humid and cool the evapotranspiration amount will be less so it will take longer for the total precipitation to fall below the threshold allowing more days between irrigation.  Likewise when it is hot and dry the evapotranspiration amount will be greater so it will quickly subtract away from the total and drop below the threshold sooner so the irrigation can resume before it dries up.

The evapotranspiration estimate will also be applied to the forecast precipitation as well.  If you think about time will elapse before that precipitation will fall but your plants will still be using water until it falls.  By subtracting the amount of evapotranspiration for each day in the future it will balance the water in and water out equation.

The user will simply enter the crop coefficient which will adjust the amount of evapotranspiration for their grass or plants.  There are plenty of coefficients already determined for most species and growing stages.  For instance most grasses have a coefficient of 0.80 or 80% of the reference crop evapotranspiration.  In theory the days in the past should be able to be set higher since the evapotranspiration model should be resetting the sensor and not the past number of days limit.

For more information on the concepts and calculations read the FAO paper 56
http://www.fao.org/docrep/x0490e/x0490e00.htm (http://www.fao.org/docrep/x0490e/x0490e00.htm)
Title: Re: Virtual Rain Sensor
Post by: theal on May 15, 2014, 11:50:18 pm

Here is an example that will create a table in lua ....

Thank you
Title: Re: Virtual Rain Sensor
Post by: sidmsmith on May 18, 2014, 11:28:35 am
This is a great app and Blake has done a great job responding to PMs as well.  Does anyone have an issue with updating the threshold value?  I am trying to change it from the default of .13 to .2 and it keeps reverting back to .13.  I have tried using the Save and Update button, modifying straight in the Advanced tab, and a few other combinations of the two.  Any suggestions?
Title: Re: Virtual Rain Sensor
Post by: blakem on May 18, 2014, 02:21:16 pm
This is a great app and Blake has done a great job responding to PMs as well.  Does anyone have an issue with updating the threshold value?  I am trying to change it from the default of .13 to .2 and it keeps reverting back to .13.  I have tried using the Save and Update button, modifying straight in the Advanced tab, and a few other combinations of the two.  Any suggestions?

Two things you can try is first make sure you enter "0.20" and not just ".2".  It needs the leading zero.  The second is close and reopen your browser.  I have still had issues where my internet explorer seems to become unresponsive to the "Save & Update" button.  I added an extra parameter to the URL request to avoid caching but it does not appear to be that simple.  I have noticed other plugins that have the same problem like the Variable Container plugins "Save" button.  Please let me know if either one of these does not fix your problem.
Title: Re: Virtual Rain Sensor
Post by: Rich1983 on May 25, 2014, 10:22:56 am
Hey

Good looking app. I apologise if this has been covered but is it possible to see the prediction in % for the day.

For example: make Lua code to sent prowl alert or something if prediction was above 70% rain.


Thank you

Rich


Sent from my iPad using Tapatalk
Title: Re: Virtual Rain Sensor
Post by: blakem on May 27, 2014, 05:12:45 pm
Hey

Good looking app. I apologise if this has been covered but is it possible to see the prediction in % for the day.

For example: make Lua code to sent prowl alert or something if prediction was above 70% rain.


Thank you

Rich


Sent from my iPad using Tapatalk
No apologies necessary.  I went ahead and added PoP to the next release which should be 2.7.  It will report the PoP for each day in a single variable delimited by commas.  I added a lua code example to the original post on converting the past precipitation to lua table from the CSV string.  You can simply substitute where appropriate to get the particular day you are interested.  The PoP value will also appear on the data tab right above to the precipitation for each day. 

The next release should be available in a week or two.  I am also still working on adding evapotranspiration estimation.  It looks like it should work out very nice once I polish it up.  For instance we just got a good amount of rain here so in this case it will probably not reset the sensor for a week rather than after two or three days like I had it set before without accounting for evapotranspiration.  It definitely makes it much more agile and intelligent in its decision making.
Title: Re: Virtual Rain Sensor
Post by: Freddan101 on May 30, 2014, 09:04:39 am
Great work! Happy that you're implementing my idea regarding temperature/evapiration. I think this will be a very nice addition to your plugin.
Title: Re: Virtual Rain Sensor
Post by: tomgru on June 03, 2014, 06:22:59 pm
Probably a stupid question, but to use this with your irrigation system, you clearly need a controller that has a plug-in.  I'm just about to pull the trigger, and want to use this with the setup.  I live in the Seattle area, so this would be GREAT. 

I'm curious what most of you are using with this?  I'm leaning towards an Opensprinker over Etherrian or Irrigation Caddy.  I really like the Rainmachine, but no plug-in yet. 
Title: Re: Virtual Rain Sensor
Post by: integlikewhoa on June 03, 2014, 07:31:59 pm
Probably a stupid question, but to use this with your irrigation system, you clearly need a controller that has a plug-in.  I'm just about to pull the trigger, and want to use this with the setup.  I live in the Seattle area, so this would be GREAT. 

I'm curious what most of you are using with this?  I'm leaning towards an Opensprinker over Etherrian or Irrigation Caddy.  I really like the Rainmachine, but no plug-in yet.

There is a whole section on Vera's and irrigation. I suggest you search there first they talk about what works and any issues.

http://forum.micasaverde.com/index.php/board,30.0.html
Title: Re: Virtual Rain Sensor
Post by: tomgru on June 03, 2014, 07:33:46 pm
Probably a stupid question, but to use this with your irrigation system, you clearly need a controller that has a plug-in.  I'm just about to pull the trigger, and want to use this with the setup.  I live in the Seattle area, so this would be GREAT. 

I'm curious what most of you are using with this?  I'm leaning towards an Opensprinker over Etherrian or Irrigation Caddy.  I really like the Rainmachine, but no plug-in yet.

There is a whole section on Vera's and irrigation. I suggest you search there first they talk about what works and any issues.

http://forum.micasaverde.com/index.php/board,30.0.html

Been reading it for the last two hours.  :D  I was just asking specifically if there was one that seemed to work any better with the virtual rain sensor. 

Just ordered the OpenSprinkler.
Title: Re: Virtual Rain Sensor
Post by: Jasonejc on June 03, 2014, 08:49:48 pm
I have the RainMachine.. which I really like but integrated whether has no idea if it actually rained at my house.. it uses AccuWhether which is great for area forecasts but not local.  I wish it had a Vera plugin but they aren't releasing the API.

I would go with something that has a Vera plug-in and better yet a WindowsPhone app!

Title: Re: Virtual Rain Sensor
Post by: blakem on June 04, 2014, 10:23:25 pm
That RainMachine looks nice.  I actually did not know that there were already controllers out there using evapotranspiration to control water usage.  I currently have a version of the Virtual Rain Sensor that I am testing that estimates the evapotranspiration each day and subtract it from the total precipitation, but the ultimate goal would be more integration with irrigation controllers to create a completely balanced equation of the water in and water out.  The two ways I see to accomplish that would be to control the length of the irrigation(zone time) or the frequency of irrigation cycles(schedule). 

Does anyone know how many controllers that integrate with the Vera will allow you to change the time of each zone?  I am not familiar with all the different types of controllers and their plugins so I would appreciate any help.  If the length of irrigations cannot be modified then you would be left with changing the frequency of irrigations.
Title: Re: Virtual Rain Sensor
Post by: Jasonejc on June 06, 2014, 09:43:40 pm
I think every irrigation controller that has ever been made has a timer function.
Title: Re: Virtual Rain Sensor
Post by: blakem on June 06, 2014, 10:57:25 pm
I think every irrigation controller that has ever been made has a timer function.
Sorry I probably didn't ask the right question.  I wanted to know, of all the controllers that integrate with Vera, how many of the plugins allow you to modify the zone time within Vera?  I assume most but I just was not sure since I have not personally researched it.

After thinking about it, I think I will make a second output that will supply the amount of irrigation needed.  That way it could integrate with the zone time to make it variable as well.  Right now it already does in a way affect the frequency of irrigations by bypassing when sufficient rain is detected.  The irrigation needed will tell how much demand there is currently for water.

irrigation needed = evapotranspiration - quantitative precipitation forecast

It would be calculated for the period of the irrigation cycle.  The only flaw to this is without the sensor knowing how much and when irrigation is applied it is not possible to correct for any change or error in the forecast.  This being a simple sensor I think I will try this basic approach now and implement a more complicated complete irrigation tracking approach later if needed.
Title: Re: Virtual Rain Sensor
Post by: Jasonejc on June 07, 2014, 07:30:55 am
I am making rain and soil sensors via the MySensors.org project.  I'm going to use a soil sensor for each zone to ensure I only irrigate when/where needed.  I live in Florida where we get 5 straight months on rain in the forecast but can go weeks without actual rain in a specific locale.
Title: Re: Virtual Rain Sensor
Post by: integlikewhoa on June 07, 2014, 10:21:36 am
we get 5 straight months on rain in the forecast but can go weeks without actual rain in a specific locale.

Have you looked were your getting your data from? Weather Underground doesn't forecast for a large area (not the same as your local news station). As a matter of fact you can choose which station you use within blocks of your house. Stations range from private homeowners, business, airports, schools and more. If your setup on weather underground check and see your area and see where the information is coming from. My info is coming from a school with a 500.00 small weather package 1.5 blocks over. I also have an airport 1 mile south of me I can use.

Also you can use a Netatmo with rain gauge attachment if you want weather taken at your house. 
Title: Re: Virtual Rain Sensor
Post by: blakem on June 07, 2014, 11:23:41 am
I am making rain and soil sensors via the MySensors.org project.  I'm going to use a soil sensor for each zone to ensure I only irrigate when/where needed.  I live in Florida where we get 5 straight months on rain in the forecast but can go weeks without actual rain in a specific locale.
Thank you for letting me know about the forecasts.  I suppose I just need to accept irrigation amounts as an input and record it just like precipitation.  That way even you could use it with the overpredicted forecast.  During your first irrigation it would say the irrigation needed amount is small since rain is predicted, but then on your second irrigation days later if no rain has fallen it will correct for that and you will need to irrigate extra to make up for that.  The only way to accomplish that is to get feedback about how much and what time the irrigation is applied.

So does this sound useful or practical to anyone?  It kind of goes away from the idea of just a rain sensor since it would also record irrigation that you manually report to it.  The advantage of it would be that you could integrate your zone timer to be variable and have a completely need based irrigation system like the RainMachine and others like it.  The RainMachine by the way does not track precipitation as far as I could tell.  It looks like it only detects a rain event in the general area and suspends irrigation for a set number of days.

Hopefully the soil moisture method will work out ok but for me I would worry about the accuracy and just the upkeep of it.
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on June 07, 2014, 12:21:50 pm
I am making rain and soil sensors via the MySensors.org project.  I'm going to use a soil sensor for each zone to ensure I only irrigate when/where needed.  I live in Florida where we get 5 straight months on rain in the forecast but can go weeks without actual rain in a specific locale.

FYI I posted on MySensors (http://mysensors.org) a project that I am building, the Tipping Bucket (http://forum.mysensors.org/topic/156/rain-guage-calling-all-makers#1151) rain gauge.

I am in the final stages of development, having the mechanism done and now working on the sketch.

For now, it will create a RAIN and a MOTION device to record rain and indicate precipitation.  If you want to look at that, I'd appreciate any comments.

I asked @blakem some questions regarding his plugin, it would be nice to develop a single device, like he so elegantly did here...

I want to get the physical device working first, though.

PS I'm in FLA too, same issue... it rains a lot, a quarter of a mile away!

Title: Re: Virtual Rain Sensor
Post by: Jasonejc on June 07, 2014, 05:06:30 pm
very cool little device.. do you have it all working yet?  I could imagine having the moisture sensor attached to this rain gauge so it not only measures the amount of rain (or irrigation) but also the actual soil moisture.

I'm planning on making my sensors solar powered but that is still just a thought at this point. 
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on June 07, 2014, 05:27:19 pm
very cool little device.. do you have it all working yet? 

Yes, but on a breadboard.  I have the hall effect sensor working, so it all needs to get mounted into the pipe housing. 

I'll be doing that next week, so I'll update the photos as I go  .I'll add in the moisture sensor to the sketch, I think that is a great idea.

The issue at this point is getting the sketch finished.

I am struggling right now with the rain device (RainSensor1) not working... I hope I can get some assistance from @lolodomo.  You can see when I include that sensor in my sketch, it glitches out the plugin.  I checked the plugin table that calls these devices, and that looks OK.  I don't have the skills to get into the xml and json files that are posted here (http://code.mios.com/trac/mios_rfxtrx/browser/trunk).

Keep an eye on MySensors for updates. 
Title: Re: Virtual Rain Sensor
Post by: Jasonejc on June 07, 2014, 06:14:30 pm
nice!  I'm happy to work on this with you.  My whole project is based on replacing my RainMachine.  It's a fine device for the average consumer but with no Vera integration and the issues with the weather forecast we've talked about it just doesn't suite my needs.  Like you said,  we get lots of rain.. a 1/4 of a mile away.

If this sensor has accurate soil sensing, does it really need rain amount sensing?  Regardless of how much rain, the soil amount is what matters right?  I guess it's a good cross check if nothing else or if you are not using the moisture probe it would be a good 'whole yard' solution like most ran gauges work.

Where can I jump in?   
Title: Re: Virtual Rain Sensor
Post by: BulldogLowell on June 07, 2014, 06:47:49 pm
I got going on the real sensor because I'm thinking I can use the rain gauge for other projects later.

You are 100% correct, though, I think if you are looking just at irrigation, the soil moisture really solves the problem.

If you are interested in a good quality moisture sensor look at the Vegetronic (http://www.vegetronix.com/Products/VG400/).

Right now, I only need to determine which vera 'device' I'm going to use for displaying accumulated rainfall.  I'm struck here until I get some help with the device.  There are a lot of great folks here knowledgeable on the vera side.

The RainMachine looks cool.  I just finished an (up to) 8 zone controller for arduino, using a shift register. 

if you are interested in building a rain gage and using that, then putting your thoughts around what periods you want to observe (prior 24hrs, 48hrs, etc) to make a decision wether to water or not, that would help.
Title: Re: Virtual Rain Sensor
Post by: tomgru on June 14, 2014, 05:46:27 pm
Description

Usage In Scene
Add a trigger and choose the Virtual Rain Sensor device

A sensor is tripped
   Device is tripped: fired when total precipitation above threshold
   Device is not tripped: fired when total precipitation below threshold

An armed sensor is tripped
   Device armed is tripped: fired when armed and total precipitation above threshold
   Device armed is not tripped: fired when armed and total precipitation below threshold


Sorry... can you tell me the difference between these two choices (e.g. armed, vs. just triped)?  Trying to figure out how to create the scene?

Also, I assume I need two scenes, one that trips to turn my Opensprinkler configuration off, and another to turn it back on with no precip?

thanks.
Title: Re: Virtual Rain Sensor
Post by: blakem on June 14, 2014, 07:05:37 pm
Sorry... can you tell me the difference between these two choices (e.g. armed, vs. just triped)?  Trying to figure out how to create the scene?

Also, I assume I need two scenes, one that trips to turn my Opensprinkler configuration off, and another to turn it back on with no precip?

thanks.
No problem.  The difference between armed and just tripped is a depends if you want to control it through the dashboard or not.  With the option of an armed sensor is tripped you can bypass the virtual rain sensor on the dashboard in case you want to ignore it for a while.  The other option does not care about the armed and bypass buttons on the dashboard and will always trigger an event.

You are correct that you will need 2 scenes.  I personally set the scene to turn off the sprinkler controller(when the virtual rain sensor is tripped) to an armed sensor is tripped option and the scene to turn it on as just the basic a device is tripped option.  That way if I bypass it the scene will still activate to turn the sprinkler controller back on, but the bypass will prevent it from shutting it off again.

Hope that helps and hope the plugin works well for your purposes.
Title: Re: Virtual Rain Sensor
Post by: Jasonejc on June 14, 2014, 08:24:39 pm
I have created a soil humidity and temperature sensor based on the MySenors.org platform.  It is battery operated, water proof and controls my irrigation per zone.  I only water when it is needed, no weather forecast, rain sensor or software needed.

My RainMachine is no longer connected or needed.. nice little RaspberryPi box but no integration with Vera.  I'm much happier with what I have now.

Title: Re: Virtual Rain Sensor
Post by: blakem on June 14, 2014, 09:48:37 pm
I have created a soil humidity and temperature sensor based on the MySenors.org platform.  It is battery operated, water proof and controls my irrigation per zone.  I only water when it is needed, no weather forecast, rain sensor or software needed.

My RainMachine is no longer connected or needed.. nice little RaspberryPi box but no integration with Vera.  I'm much happier with what I have now.
Good work

I was curious, how deep did you place your soil moisture sensor?  From reading up on all of this irrigation theory from the food and agriculture organization, I found that the effective root length of a plant is an important factor in how much water it has available to it.  Essentially if it rains a ridiculous amount the top layer of soil becomes saturated and the water will collect and run off the surface or percolate deep into the soil where the plant cannot reach it.  So if you placed the sensor at the effective root depth of the plant you are irrigating then it should work well.

Do you do cycle and soak?  You don't need to but it would conserve the most water since it takes time for the moisture to reach the sensor and turn off the valve.  Any extra would run off or be lost to deep percolation.
Title: Virtual Rain Sensor
Post by: pkcosgrove on June 22, 2014, 05:31:57 pm
I have been using the virtual rain sensor for awhile now. I recently added my own weather station which is now registered and appears on Weather underground. However I can't seem to get the rain sensor to use my location as it's data source.
I  have tried manually changing to my lat long, uninstalling and reinstalling and pointing to my location. But it doesn't seem to work.
How do I tell it to use my station?
Title: Re: Virtual Rain Sensor
Post by: blakem on June 23, 2014, 08:40:42 am
I have been using the virtual rain sensor for awhile now. I recently added my own weather station which is now registered and appears on Weather underground. However I can't seem to get the rain sensor to use my location as it's data source.
I  have tried manually changing to my lat long, uninstalling and reinstalling and pointing to my location. But it doesn't seem to work.
How do I tell it to use my station?
If you put "pws:" followed by your station id as your location then it will only use that station.

With lat long it will find the closest station but since yours is new it might not be on that list yet. I could see the API having a separate copy of the personal weather station list in its database.
Title: Re: Virtual Rain Sensor
Post by: tomgru on June 29, 2014, 03:42:09 pm
Sorry... can you tell me the difference between these two choices (e.g. armed, vs. just triped)?  Trying to figure out how to create the scene?

Also, I assume I need two scenes, one that trips to turn my Opensprinkler configuration off, and another to turn it back on with no precip?

thanks.
No problem.  The difference between armed and just tripped is a depends if you want to control it through the dashboard or not.  With the option of an armed sensor is tripped you can bypass the virtual rain sensor on the dashboard in case you want to ignore it for a while.  The other option does not care about the armed and bypass buttons on the dashboard and will always trigger an event.

You are correct that you will need 2 scenes.  I personally set the scene to turn off the sprinkler controller(when the virtual rain sensor is tripped) to an armed sensor is tripped option and the scene to turn it on as just the basic a device is tripped option.  That way if I bypass it the scene will still activate to turn the sprinkler controller back on, but the bypass will prevent it from shutting it off again.

Hope that helps and hope the plugin works well for your purposes.

Hey there... so far so good in tripping and turning off the sprinklers.  But I think I'm missing something, as it doesn't seem to reset and turn them back on when precip goes below threshold.  Any chance you could show me a screen shot of what your scene looks like?

Thanks!
Title: Re: Virtual Rain Sensor
Post by: blakem on June 29, 2014, 04:23:38 pm
Hey there... so far so good in tripping and turning off the sprinklers.  But I think I'm missing something, as it doesn't seem to reset and turn them back on when precip goes below threshold.  Any chance you could show me a screen shot of what your scene looks like?

Thanks!

I don't have a screen shot but it does sound like you only have one scene to turn off you sprinkler but you don't have a second to turn on your sprinkler.  Just create a new scene that turns on the sprinkler and then add the virtual rain sensor as a trigger.

On the add trigger page of your scene, select the virtual rain sensor device.  On the "What type of event is the trigger?: " select, "an armed sensor is tripped".  Then give the trigger a name and select "Device armed is not tripped".

EDIT: I just scrolled up and saw your last post.  It sounds like you are using two scenes but you did not select the correct type of logic on one of them.  The turn off scene will have "Device armed is tripped", the turn on scene will have "Device armed is not tripped".
Title: Re: Virtual Rain Sensor
Post by: tomgru on June 30, 2014, 03:46:56 pm
Awesome... I'll try that!
Title: Re: Virtual Rain Sensor
Post by: tyfoon on July 01, 2014, 04:28:02 pm
I'm also still a bit confused.

I want to:
Scene1: have the sprinkler turn on every day at 22:00 IF rain less then threshold
Scene2: Turn off always at 22:30

Scene 2 is simple. But how should I setup scene 1?

p.s. I normally use PLEG for this stuff and used scenes only for very basic stuff, so really not sure how to do this...





Title: Re: Virtual Rain Sensor
Post by: blakem on July 02, 2014, 06:03:23 pm
I'm also still a bit confused.

I want to:
Scene1: have the sprinkler turn on every day at 22:00 IF rain less then threshold
Scene2: Turn off always at 22:30

Scene 2 is simple. But how should I setup scene 1?

p.s. I normally use PLEG for this stuff and used scenes only for very basic stuff, so really not sure how to do this...
It is easy with PLEG.  Open your PLEG instance and select the INPUTS tab, then the DEVICE PROPERTIES.  Select the Virtual Rain Sensor device from the drop down then select "Tripped" from the drop down next to it followed by the Accept button.  Give it a name and use the name in a condition like any other input. 

0 = no rain detected
1 = rain detected
Title: Re: Virtual Rain Sensor
Post by: kyb2012 on July 03, 2014, 02:50:07 am
When using this plugin with PLEG,  do you have to use the device properties to get the tripped value our can you just use the device input and selected from dropdown of  armed sensor is tripped?
When I tried the latter, PLEG never seemed to set the condition to true.
Title: Re: Virtual Rain Sensor
Post by: blakem on July 03, 2014, 06:25:40 am
Sorry I forgot to add that you will need to setup 2 conditions that trigger 2 actions.

No rain turns the sprinkler on.
Rain detected turns the sprinkler off.

You will need that setup with either type input but the condition logic may differ. I will look into the event triggered input you mentioned later today.

Title: Re: Virtual Rain Sensor
Post by: tbully on July 14, 2014, 07:45:07 pm
Hello Everyone!

I have a question that may be more WUnderground Related than the plugin itself.

My station (KMICANTO5) is currently reading a total of .27 inches of rain today.  We had a .26 event and a .01 event just a few minutes ago. 

The odd thing is, the Virtual Rain Sensor is showing .09 inches.  This is not enough to "trip" the sensor and is therefore telling my system to water the lawn tonight.   .27 is plenty of water so I will manually disarm the sensor but I was hoping someone could help me troubleshoot this.

I did make sure I used "pws:KMICANTO5" in the config to look at only my station.

Attached are images of the sensor and Wunderground.

Any ideas?
 
Title: Re: Virtual Rain Sensor
Post by: blakem on July 14, 2014, 08:56:48 pm
Hello Everyone!

I have a question that may be more WUnderground Related than the plugin itself.

My station (KMICANTO5) is currently reading a total of .27 inches of rain today.  We had a .26 event and a .01 event just a few minutes ago. 

The odd thing is, the Virtual Rain Sensor is showing .09 inches.  This is not enough to "trip" the sensor and is therefore telling my system to water the lawn tonight.   .27 is plenty of water so I will manually disarm the sensor but I was hoping someone could help me troubleshoot this.

I did make sure I used "pws:KMICANTO5" in the config to look at only my station.

Attached are images of the sensor and Wunderground.

Any ideas?
The problem is actually from the personal weather station software. It should report the total rain for the whole day and reset at midnight(beginning of the next day).  This station looks like it reset from 0.26 to 0.00 at 1:40pm which it should have waited until midnight.  The 0.09 inches that you are seeing is actually from the forecasted precipitation for the remainder of the day.  I personally do not know why some personal weather stations do this but I have come across it before during testing.  My plugin simply reads the latest observation and not the max for the day since it should be accumulating throughout the day and reset the beginning of the next day.  Hope that helps.
Title: Re: Virtual Rain Sensor
Post by: tbully on July 14, 2014, 08:59:57 pm
It does, thanks.

I will try to figure out why it's not reporting correctly.  (Perhaps it will at midnight?)

It's just a Davis Pro II (actually an "Envoy") using WeatherLink software.

Title: Re: Virtual Rain Sensor
Post by: Ramias on July 15, 2014, 04:22:19 pm
I'm also still a bit confused.

I want to:
Scene1: have the sprinkler turn on every day at 22:00 IF rain less then threshold
Scene2: Turn off always at 22:30

Scene 2 is simple. But how should I setup scene 1?

p.s. I normally use PLEG for this stuff and used scenes only for very basic stuff, so really not sure how to do this...
It is easy with PLEG.  Open your PLEG instance and select the INPUTS tab, then the DEVICE PROPERTIES.  Select the Virtual Rain Sensor device from the drop down then select "Tripped" from the drop down next to it followed by the Accept button.  Give it a name and use the name in a condition like any other input. 

0 = no rain detected
1 = rain detected

I have this set up but am using the "Forecasted Precipitation" variable and either GE or LT .5 (for half an inch). 

PLEG shows it as TRUE ( it is raining more than .5 inches today) but on reloading Vera it does not set the sprinkler off (I do this through Luup code that I've tested via the LUUP test tool).

Is there a way to force PLEG ot evaluate these conditions?  Virtual Rain Sensor shows .70 for today, so the "Is Raining" condition should be true and trigger this.
Title: Re: Virtual Rain Sensor
Post by: blakem on July 15, 2014, 10:17:19 pm
I'm also still a bit confused.

I want to:
Scene1: have the sprinkler turn on every day at 22:00 IF rain less then threshold
Scene2: Turn off always at 22:30

Scene 2 is simple. But how should I setup scene 1?

p.s. I normally use PLEG for this stuff and used scenes only for very basic stuff, so really not sure how to do this...
It is easy with PLEG.  Open your PLEG instance and select the INPUTS tab, then the DEVICE PROPERTIES.  Select the Virtual Rain Sensor device from the drop down then select "Tripped" from the drop down next to it followed by the Accept button.  Give it a name and use the name in a condition like any other input. 

0 = no rain detected
1 = rain detected

I have this set up but am using the "Forecasted Precipitation" variable and either GE or LT .5 (for half an inch). 

PLEG shows it as TRUE ( it is raining more than .5 inches today) but on reloading Vera it does not set the sprinkler off (I do this through Luup code that I've tested via the LUUP test tool).

Is there a way to force PLEG ot evaluate these conditions?  Virtual Rain Sensor shows .70 for today, so the "Is Raining" condition should be true and trigger this.
I would love to help, but I am not sure what you are trying to achieve.  The "Tripped" variable is the better way to set it up.  If you are only interested in the forecast and not the past precipitation then you can reconfigure the Virtual Rain Sensor or the settings tab to only use the forecast.
Title: Re: Virtual Rain Sensor
Post by: icare on July 16, 2014, 02:10:11 am
--Force update(this step optional)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "Update", {}, 27)

--Get current state
local rain = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped", 27)

if (rain == "0")
then

luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },15)

return true

else
return false
end


This works for me based on past rain. Can't really reconcile why you wish to rely on "forecast"!
Title: Re: Virtual Rain Sensor
Post by: chuck1026 on July 22, 2014, 06:31:51 am
Just started getting a Vera3 dashboard error "VRainSensor : Error, failed to GET=http://api.wunderground.com/api/............."

 ??? ??? ???
Title: Re: Virtual Rain Sensor
Post by: blakem on July 22, 2014, 07:23:30 am
Just started getting a Vera3 dashboard error "VRainSensor : Error, failed to GET=http://api.wunderground.com/api/............."

 ??? ??? ???
I got the same message when I logged in as well.  After looking into it the problem is with the API itself.  It looks like the API never returns a response when requesting the history of a personal weather station.  Airports are still reporting their history just fine.  I think it will correct itself with time. For now the plugin will still give you the current precip today as well as the forecast.
Title: Re: Virtual Rain Sensor
Post by: chuck1026 on July 22, 2014, 11:20:44 am
Ok that makes perfect sense! Thanks for the explanation :) .
Title: Re: Virtual Rain Sensor
Post by: dzmiller on July 30, 2014, 05:28:42 pm
Blakem, nice job, thanks for doing this.

I'm going to crudely estimate evapotranspiration based on temp alone. I know at 65f a quarter inch of rain is meaningful, and at 95f it's not. So I think any attempt to adjust the threshold precip. is advantageous. Otherwise the threshold number needs to be constantly tweaked as the seasons progress.

Title: Re: Virtual Rain Sensor
Post by: bwillette on August 04, 2014, 10:37:59 am
Blakem, this is a GREAT plugin, thank you for putting it together.  I'm leveraging it with my newly installed OpenSprinkler (and the plugin for that device obviously).

One thing that strikes me as being extremely well-suited to add to your plugin (incoming feature enhancement request!) that I realize takes it SLIGHTLY out of it's current paradigm, is the addition of a temperature threshold, very similar to the precipitation one you put together.  Here in the tundra of Colorado, we're nearing the season of freeze alerts and the like, and I think an algorithm similar to what you've done with the precipitation (leveraging the weather data you're already tapping!) based on temperature and thresholds, to similarly turn off the device (when it drops below a certain temp threshold), would be FANTASTIC.

I looked around, and couldn't find anything else that fit this need, and thought you were already well poised to augment your plugin with this type of thing, if others found it useful.

Food for thought, and thanks again for your efforts!
Title: Re: Virtual Rain Sensor
Post by: tomgru on August 04, 2014, 11:09:07 am
Blakem, this is a GREAT plugin, thank you for putting it together.  I'm leveraging it with my newly installed OpenSprinkler (and the plugin for that device obviously).

One thing that strikes me as being extremely well-suited to add to your plugin (incoming feature enhancement request!) that I realize takes it SLIGHTLY out of it's current paradigm, is the addition of a temperature threshold, very similar to the precipitation one you put together.  Here in the tundra of Colorado, we're nearing the season of freeze alerts and the like, and I think an algorithm similar to what you've done with the precipitation (leveraging the weather data you're already tapping!) based on temperature and thresholds, to similarly turn off the device (when it drops below a certain temp threshold), would be FANTASTIC.

I looked around, and couldn't find anything else that fit this need, and thought you were already well poised to augment your plugin with this type of thing, if others found it useful.

Food for thought, and thanks again for your efforts!

Cool idea
Title: Re: Virtual Rain Sensor
Post by: dzmiller on August 04, 2014, 12:15:17 pm
........  Here in the tundra of Colorado, we're nearing the season of freeze alerts and the like,.......

Would a freeze alert require more than two fields?

1) Threshold Temp, and
2) Enable/ Disable bit

Even the enable bit wouldn't be absolutely necessary. It gets more complicated if freeze alert is based on forecast. Considering irrigation is often started at the coldest time of day, the best freeze alert might look at the forecast and set the rain flag based on the forecast low. I assume you don't want to irrigate immediately before freezing temps.

Freeze alert needs to be optional, as irrigation is used to prevent frost damage on some crops.

Title: Re: Virtual Rain Sensor
Post by: bwillette on August 04, 2014, 03:44:45 pm
Would a freeze alert require more than two fields?

1) Threshold Temp, and
2) Enable/ Disable bit

Even the enable bit wouldn't be absolutely necessary.
...
Freeze alert needs to be optional, as irrigation is used to prevent frost damage on some crops.
This seems reasonable, and obviously the temp threshold would be based on the low temp of the day.  Maybe the enable/disable toggle would help with the optional qualifier you mention.

It gets more complicated if freeze alert is based on forecast. Considering irrigation is often started at the coldest time of day, the best freeze alert might look at the forecast and set the rain flag based on the forecast low. I assume you don't want to irrigate immediately before freezing temps.
I was thinking it'd be nice to have it setup like the precipitation is done now, where you can optionally include the forecast, or base it strictly on the current temperature (no need to having a history of days, like the precip does however).  Most flexibility that way I would think.  I agree with you though, MOST of us would want to use the forecast in this case.
Title: Re: Virtual Rain Sensor
Post by: dzmiller on August 04, 2014, 04:04:13 pm
Shouldn't be a problem to look at current temp and the next forecast periods. That would turn the flag on with generally dropping temps, and turn it back on when the current temp is acceptable and no freezing temps are expected soon.

Realistically it would probably work fairly well to just look at current temp and set the threshold value fairly high. Say "set the flag when the temp falls below 40". But with the WU forecast lows readily available it seems that these values should be used.

This functionality really shouldn't be separate from Virtual Rain because the freeze control needs to be preeminent over the precipitation flag setting logic.
Title: Re: Virtual Rain Sensor
Post by: bwillette on August 04, 2014, 04:10:07 pm
This functionality really shouldn't be separate from Virtual Rain because the freeze control needs to be preeminent over the precipitation flag setting logic.
That was my thought too, it would nicely complement what has already been done here, and the two features could (optionally) work in concert.  Only downside would be the plugin does more than just rain now, so the name may not fit anymore!  Hehe.

Again, just throwing all this out here to see if anyone else resonates with the idea like I do.  The plugin is wonderful as it is.
Title: Re: Virtual Rain Sensor
Post by: blakem on August 05, 2014, 10:30:25 pm
This functionality really shouldn't be separate from Virtual Rain because the freeze control needs to be preeminent over the precipitation flag setting logic.
That was my thought too, it would nicely complement what has already been done here, and the two features could (optionally) work in concert.  Only downside would be the plugin does more than just rain now, so the name may not fit anymore!  Hehe.

Again, just throwing all this out here to see if anyone else resonates with the idea like I do.  The plugin is wonderful as it is.
I am sorry I have been away from the thread for some time.  I think frost protection could be added but would the threshold be compared to only the low temp of the current day or the lowest of the low temps visible in the forecast?

Also I have currently a version of the plugin with evapotranspiration but I stopped developing it.  The problem I was having is that I was trying to make it completely balanced which is difficult.  The plugin cannot balance all the water without knowing how much irrigation is applied and that made it too complicated.  An automatic threshold might just work though.  You can set the number of days to the period that you normally irrigate then if the total rain is over the evapotranspiration total of that period it will trigger a rain detected condition.  That way there is no balancing but it will give you an adjustable threshold.  You just set the crop coefficient factor which is 0.60 for warm grasses and 0.80 for cool grasses.
Title: Re: Virtual Rain Sensor
Post by: bwillette on August 05, 2014, 10:40:03 pm
I am sorry I have been away from the thread for some time.  I think frost protection could be added but would the threshold be compared to only the low temp of the current day or the lowest of the low temps visible in the forecast?
No worries Blake, I just brought it up a day ago, you're allowed a break now and again!

I think it would be the lowest of the low temps you've selected, where you can use just the current temp, OR include the forecast optionally, as you allow with the precipitation (ie today, 1 day ahead, 2 days ahead, etc).  You just don't need the concept of 'accumulation' from past days, as this doesn't really make sense for temperature I think.

Thanks for considering this feature!
Title: Re: Virtual Rain Sensor
Post by: dzmiller on August 06, 2014, 12:50:28 pm
Yeah, you really can't do the ET model for irrigated land without knowing the irrigation. There's at least one effort to add ET to opensprinkler. I assume this will involve the user entering irrigation rate per zone. Then the irrigation controller will accumulate irrigation amounts based on zone run time.

In the diverse home landscape I expect ET models won't produce better results than simpler approaches. Which is why I'm looking at ramping the threshold based on temps. Everyone in potentially hot summer areas, who is closely attending their irrigation system, will be doing that manually anyways. So why not automate the function.

Anyone running multiple occurrences of Virtual Rain? I tried and had problems.
Title: Re: Virtual Rain Sensor
Post by: dzmiller on August 08, 2014, 09:32:50 am
Has wind been considered?

Some higher end controllers have an anemometer option that sets the rain flag for windy conditions. Easy to code in scenes, so perhaps it doesn't need to be included in the plugin. But on most controllers wind would be implemented through the rain flag, so perhaps it belongs in this plugin as an option.

WU likely offers both a short term average and gusts in the API. How to handle these two current conditions is the only wind  issue I can think of.
Title: Re: Virtual Rain Sensor
Post by: CoreDex on September 14, 2014, 10:48:37 pm
This plug-in looks great, but when I install it, I can't seem to finish configuring it.  The "Settings" tab has the message "Please refresh your browser then reopen this tab...", but after refreshing or restarting it persists.   I tried uninstall, reinstalling to no effect.

Any suggestions?

Thank you.
Title: Re: Virtual Rain Sensor
Post by: CoreDex on September 20, 2014, 11:00:15 am
I wanted to post the resolution I found to my problem referenced in the post above.  I created a scene and used the LUUP call to set my device API key and a few other settings for the sensor.  After I did this, the settings tab began to display properly with values. 

Just thought I post in case anyone else has the same problem and this resolves it.  The plug-in looks really great, I am now putting it to use with my Irrigation Caddy!
Title: Re: Virtual Rain Sensor
Post by: TwannieM on February 25, 2015, 06:54:32 pm
I created a dutch forcast tile (.json)
Title: Virtual Rain Sensor
Post by: dbmet on March 09, 2015, 04:24:35 pm
Is anyone else having trouble with this plugin? Its giving an underground error when its been working fine for several months
Title: Re: Virtual Rain Sensor
Post by: blakem on March 10, 2015, 06:57:46 pm
Is anyone else having trouble with this plugin? Its giving an underground error when its been working fine for several months
Yes I have been having the same problems the last couple of days with it not updating.  I remember this happening a year ago and returning to normal in a short time.  The problem is with the WGET LUUP command where it returns with a status other than 0 for successful.  I think the Weather Underground API just does not respond quick enough some times so the connection times out on the Vera side.  I will continue to monitor it, but I am hoping it will return to normal in a day or two.  Currently when a GET is not successful it will default to reporting a no rain condition so irrigation can resume.
Title: Re: Virtual Rain Sensor
Post by: tomgru on March 10, 2015, 07:18:54 pm
i find another refresh usually fixes it.
Title: Re: Virtual Rain Sensor
Post by: dbmet on March 10, 2015, 08:50:38 pm
Yup that's exactly what mine is doing as well. I just turned off my scene for now to wait and see if it fixed itself. Lol


Sent from my iPhone using Tapatalk
Title: Re: Virtual Rain Sensor
Post by: blakem on March 16, 2015, 10:13:10 pm
No more issues since my last post.

I am also happy to announce that version 3.0 has been submitted to the app store.  It estimates the daily evapotranspiration and uses the sum to continually update the threshold.  That way you will have a quantifiable amount matching your plants water needs and it will be easier to use throughout the seasons than manually updating the threshold periodically.  Just set the coefficient for your plants water needs and the number of days you want to monitor.  I have been using it for 8 months without any issues.

So be on the lookout for the new version once it is released.  All the legacy features are still included so it should hopefully not affect any one negatively during the upgrade.  If the upgrade does cause problems I apologize and the previous version 2.8 is still available in the app store to roll back.
Title: Re: Virtual Rain Sensor
Post by: dbmet on March 17, 2015, 08:51:26 am
I didn't have any problems either after I posted. Lol. Awesome thanks for the new release!!


Sent from my iPhone using Tapatalk
Title: Re: Virtual Rain Sensor
Post by: bwillette on April 28, 2015, 10:26:02 pm
I am also happy to announce that version 3.0 has been submitted to the app store.

I just checked out the updated plugin and see you added the 'Low Temperature Cutoff'!  That's fantastic, thanks for doing that!
Title: Re: Virtual Rain Sensor
Post by: wmichael3 on May 08, 2015, 01:18:49 pm
I love what you've done here but I have an issue I hope you can help me with: the rain data in the Virtual Rain Sensor device isn't matching the data from Weather Underground for my PWS.  Right now it is correct for the current day, May 8th, 2015, showing 0.17 inches, but shows zeros for the two previous days, where it should show 0.43 inches for May 7th and 0.01 inches for May 6th.  Here is the Weather Underground page showing the 0.43 inches for May 7th: http://www.wunderground.com/personal-weather-station/dashboard?ID=KCODENVE131#history/s20150507/e20150507/mdaily (http://www.wunderground.com/personal-weather-station/dashboard?ID=KCODENVE131#history/s20150507/e20150507/mdaily).  Here is a JSON API query that contains the same data: http://api.wunderground.com/api/473688002950f03b/history_20150507/q/pws:KCODENVE131.json (http://api.wunderground.com/api/473688002950f03b/history_20150507/q/pws:KCODENVE131.json).  Both the PWS and the Vera are at the same location in the same timezone.  I'm on version 3.0 of your plugin and there are no visible errors anywhere.

Any ideas?

----- Update ------

I think I've identified the problem.  For a PWS you use the <observations> nodes in the WeatherUnderground XML response document to determine historical precipitation totals using a regular expression:

precipTotalRegExp = ".*&lt;precip_totali&gt;(.-)&lt;/precip_totali&gt;"

However, the last observation for my PWS of every day from Weather Underground is at 11:59 local time and that observation resets the value of precip_totali to zero.  I am uploading weather (via Cumulus) from my PWS at 15 minute intervals and although my clock is internet synchronized, it appears that a tiny variation between my time and WeatherUnderground time is enough for this to happen -  it is a weakness in the WeatherUnderground API, or it is a bug in Cumulus.  I am going to change my upload frequency to 14 minute intervals on the theory that the last observation will be sent at 11:56pm and will be correct for the proceeding day.  I'm also going to update my computer's clock daily rather than weekly. I'll modify this post if I am correct.

----- Update -----

Changing the upload frequency to 14 minutes fixed the issue; the last observation of every day is now accurate.



Title: Re: Virtual Rain Sensor
Post by: blakem on May 08, 2015, 05:13:16 pm
I just checked out the updated plugin and see you added the 'Low Temperature Cutoff'!  That's fantastic, thanks for doing that!
No problem, hope all is still working well for those still using the plugin.

Never would have thought I would see my rain sensor in the double digits, but I did yesterday.  I posted a screen shot.  Surprising how much rain we got.  I'd still rather have the rain and flooding over the tornadoes.
Title: Re: Virtual Rain Sensor
Post by: WS on May 19, 2015, 01:56:04 pm
Hi, all, this is my first post to the forum.  I have used Virtual Rain Sensor for several months now and LOVE it.  However, recently I can no longer access the "Settings" tab (for example, to change the source for the weather information).  I get an error from VERA saying:

Error executing function settings(): displayUnitsChanged is not defined

I am on version 3.0 of the Virtual Rain Sensor app and 1.7.583 of Vera (running on a vera Lite).

Thanks in advance for any insight.
Title: Re: Virtual Rain Sensor
Post by: pepe6859 on May 20, 2015, 03:26:06 am
Is there anyway to know if the station a I am looking at is down? Or even better, is there a way to auto switch between the three stations in my area to keep me attached to a "live" one.

Regards,
Title: Re: Virtual Rain Sensor
Post by: blakem on May 20, 2015, 06:27:39 am
I love what you've done here but I have an issue I hope you can help me with: the rain data in the Virtual Rain Sensor device isn't matching the data from Weather Underground for my PWS.  Right now it is correct for the current day, May 8th, 2015, showing 0.17 inches, but shows zeros for the two previous days, where it should show 0.43 inches for May 7th and 0.01 inches for May 6th.  Here is the Weather Underground page showing the 0.43 inches for May 7th: http://www.wunderground.com/personal-weather-station/dashboard?ID=KCODENVE131#history/s20150507/e20150507/mdaily (http://www.wunderground.com/personal-weather-station/dashboard?ID=KCODENVE131#history/s20150507/e20150507/mdaily).  Here is a JSON API query that contains the same data: http://api.wunderground.com/api/473688002950f03b/history_20150507/q/pws:KCODENVE131.json (http://api.wunderground.com/api/473688002950f03b/history_20150507/q/pws:KCODENVE131.json).  Both the PWS and the Vera are at the same location in the same timezone.  I'm on version 3.0 of your plugin and there are no visible errors anywhere.

Any ideas?

----- Update ------

I think I've identified the problem.  For a PWS you use the <observations> nodes in the WeatherUnderground XML response document to determine historical precipitation totals using a regular expression:

precipTotalRegExp = ".*&lt;precip_totali&gt;(.-)&lt;/precip_totali&gt;"

However, the last observation for my PWS of every day from Weather Underground is at 11:59 local time and that observation resets the value of precip_totali to zero.  I am uploading weather (via Cumulus) from my PWS at 15 minute intervals and although my clock is internet synchronized, it appears that a tiny variation between my time and WeatherUnderground time is enough for this to happen -  it is a weakness in the WeatherUnderground API, or it is a bug in Cumulus.  I am going to change my upload frequency to 14 minute intervals on the theory that the last observation will be sent at 11:56pm and will be correct for the proceeding day.  I'm also going to update my computer's clock daily rather than weekly. I'll modify this post if I am correct.

I am sorry I missed your post somehow but it looks like you got it working. I encountered several personal weather stations that had this bug where the last observation of the day would be zero.  I thought about putting in code to read the max observation of the day, but when 99% report the highest as the last observation it just made sense to use that value.

Hi, all, this is my first post to the forum.  I have used Virtual Rain Sensor for several months now and LOVE it.  However, recently I can no longer access the "Settings" tab (for example, to change the source for the weather information).  I get an error from VERA saying:

Error executing function settings(): displayUnitsChanged is not defined

I am on version 3.0 of the Virtual Rain Sensor app and 1.7.583 of Vera (running on a vera Lite).

Thanks in advance for any insight.


I am not sure why it would give you that error.  It sounds like a java script error from the browser.  What browser are you using? Have you tried accessing it from a different browser like IE, Chrome or Firefox?  I would try to uninstall the app the then reinstall it.  Hopefully that will overwrite the file incase it got corrupted.

Is there anyway to know if the station a I am looking at is down? Or even better, is there a way to auto switch between the three stations in my area to keep me attached to a "live" one.

Regards,

When you set your location as "PWS:myfavoritepws" it will only use that site even if it is down.  I believe it is the same with airport codes as well.  If you put in the exact "lat,long" of your location then the weather underground API will return the nearest online station.  This is how mine is set.  I occasionally see it switch to another site when I am reviewing the data tab.
Title: Re: Virtual Rain Sensor
Post by: pepe6859 on May 20, 2015, 06:35:05 am
I love what you've done here but I have an issue I hope you can help me with: the rain data in the Virtual Rain Sensor device isn't matching the data from Weather Underground for my PWS.  Right now it is correct for the current day, May 8th, 2015, showing 0.17 inches, but shows zeros for the two previous days, where it should show 0.43 inches for May 7th and 0.01 inches for May 6th.  Here is the Weather Underground page showing the 0.43 inches for May 7th: http://www.wunderground.com/personal-weather-station/dashboard?ID=KCODENVE131#history/s20150507/e20150507/mdaily (http://www.wunderground.com/personal-weather-station/dashboard?ID=KCODENVE131#history/s20150507/e20150507/mdaily).  Here is a JSON API query that contains the same data: http://api.wunderground.com/api/473688002950f03b/history_20150507/q/pws:KCODENVE131.json (http://api.wunderground.com/api/473688002950f03b/history_20150507/q/pws:KCODENVE131.json).  Both the PWS and the Vera are at the same location in the same timezone.  I'm on version 3.0 of your plugin and there are no visible errors anywhere.

Any ideas?

----- Update ------

I think I've identified the problem.  For a PWS you use the <observations> nodes in the WeatherUnderground XML response document to determine historical precipitation totals using a regular expression:

precipTotalRegExp = ".*&lt;precip_totali&gt;(.-)&lt;/precip_totali&gt;"

However, the last observation for my PWS of every day from Weather Underground is at 11:59 local time and that observation resets the value of precip_totali to zero.  I am uploading weather (via Cumulus) from my PWS at 15 minute intervals and although my clock is internet synchronized, it appears that a tiny variation between my time and WeatherUnderground time is enough for this to happen -  it is a weakness in the WeatherUnderground API, or it is a bug in Cumulus.  I am going to change my upload frequency to 14 minute intervals on the theory that the last observation will be sent at 11:56pm and will be correct for the proceeding day.  I'm also going to update my computer's clock daily rather than weekly. I'll modify this post if I am correct.

I am sorry I missed your post somehow but it looks like you got it working. I encountered several personal weather stations that had this bug where the last observation of the day would be zero.  I thought about putting in code to read the max observation of the day, but when 99% report the highest as the last observation it just made sense to use that value.

Hi, all, this is my first post to the forum.  I have used Virtual Rain Sensor for several months now and LOVE it.  However, recently I can no longer access the "Settings" tab (for example, to change the source for the weather information).  I get an error from VERA saying:

Error executing function settings(): displayUnitsChanged is not defined

I am on version 3.0 of the Virtual Rain Sensor app and 1.7.583 of Vera (running on a vera Lite).

Thanks in advance for any insight.


I am not sure why it would give you that error.  It sounds like a java script error from the browser.  What browser are you using? Have you tried accessing it from a different browser like IE, Chrome or Firefox?  I would try to uninstall the app the then reinstall it.  Hopefully that will overwrite the file incase it got corrupted.

Is there anyway to know if the station a I am looking at is down? Or even better, is there a way to auto switch between the three stations in my area to keep me attached to a "live" one.

Regards,

When you set your location as "PWS:myfavoritepws" it will only use that site even if it is down.  I believe it is the same with airport codes as well.  If you put in the exact "lat,long" of your location then the weather underground API will return the nearest online station.  This is how mine is set.  I occasionally see it switch to another site when I am reviewing the data tab.

That makes a lot of sense!!!  Will give a try immediately, Thanks a lot!!! Fantastic!!!
Title: Re: Virtual Rain Sensor
Post by: pepe6859 on May 21, 2015, 02:41:03 am
Like WS posted above,  now I am receiving this message "Error executing function settings(): 'displayUnitsChanged' is undefined"     when trying to enter in SETTINGS. I erased the API and reinstaled back as well weather API. Not success. The rain sensor is working but not threshold can be given. 

I used Firefox and Chrome from OSX - Chrome and IE from windows. No one worked.

Firmware v 1.7.541 on VeraLite
Title: Re: Virtual Rain Sensor
Post by: blakem on May 21, 2015, 10:23:05 pm
Like WS posted above,  now I am receiving this message "Error executing function settings(): 'displayUnitsChanged' is undefined"     when trying to enter in SETTINGS. I erased the API and reinstaled back as well weather API. Not success. The rain sensor is working but not threshold can be given. 

I used Firefox and Chrome from OSX - Chrome and IE from windows. No one worked.

Firmware v 1.7.541 on VeraLite

I published a new version 3.1 that has an updated java script file.  Basically I just removed the call to the missing function.  I hope that fixes it.  It was left over from an older version and I must have overlooked it.  Odd that there is no errors with UI5.  Since I do not have UI7 someone else will have to install it and verify that it fixes it.
Title: Re: Virtual Rain Sensor
Post by: pepe6859 on May 21, 2015, 11:37:18 pm

Like WS posted above,  now I am receiving this message "Error executing function settings(): 'displayUnitsChanged' is undefined"     when trying to enter in SETTINGS. I erased the API and reinstaled back as well weather API. Not success. The rain sensor is working but not threshold can be given. 

I used Firefox and Chrome from OSX - Chrome and IE from windows. No one worked.

Firmware v 1.7.541 on VeraLite

I published a new version 3.1 that has an updated java script file.  Basically I just removed the call to the missing function.  I hope that fixes it.  It was left over from an older version and I must have overlooked it.  Odd that there is no errors with UI5.  Since I do not have UI7 someone else will have to install it and verify that it fixes it.

Yes!!!! Fixed and back in service. Thank you!!!

Nice work blakem, very useful app I've been using since long time to cut my irrigation system with vera, saving tons of water!!!


Sent from my iPhone using Tapatalk
Title: Re: Virtual Rain Sensor
Post by: WS on May 23, 2015, 12:25:35 am
Works great now!  Thanks for making the change.  The app is fantastic and so is the support.
Title: Re: Virtual Rain Sensor
Post by: rafale77 on June 27, 2015, 11:46:45 pm
Would it be possible to make the icon work for UI7?

Edit: I did it myself. Maybe blakem can can add it to the D_VRainSensor1.json file: I just modified the header as follows

Code: [Select]
{
    "flashicon": "icon/VRainSensor.png",
    "default_icon": "VRainSensor.png",
    "imgIconBody": "",
    "imgIconDimmable": "",
    "imgIconTurnable": "",
    "imgIconMin": "",
    "imgIconMax": "",
    "halloIconsDir": "pics/hallo",
    "x": "2",
    "y": "3",
    "state_icons": [

  {
            "img": "VRainSensor_0.png",
            "conditions": [
                {
                    "service": "urn:micasaverde-com:serviceId:SecuritySensor1",
                    "variable": "Tripped",
                    "operator": "==",
                    "value": "0",
                }
            ]
        },
        {
            "img": "VRainSensor_100.png",
            "conditions": [
                {
                    "service": "urn:micasaverde-com:serviceId:SecuritySensor1",
                    "variable": "Tripped",
                    "operator": "==",
                    "value": "1",
                }
            ]
        }
    ],

We then need to move the 3 icon files to the www/cmh/default/img/devices/device_states/ and voila!
Title: Re: Virtual Rain Sensor
Post by: copekyle on July 13, 2015, 11:37:57 am
So I'm getting this error at the top of my dashboard on UI7.  "VRainSensor: Error, observation precip section not found in history data".  Can anyone tell me what it means and how to fix it?
Title: Re: Virtual Rain Sensor
Post by: robertgabrielson on July 31, 2015, 11:38:53 am
So I'm getting this error at the top of my dashboard on UI7.  "VRainSensor: Error, observation precip section not found in history data".  Can anyone tell me what it means and how to fix it?

Here too.
Title: Re: Virtual Rain Sensor
Post by: blakem on August 04, 2015, 06:49:03 am
So I'm getting this error at the top of my dashboard on UI7.  "VRainSensor: Error, observation precip section not found in history data".  Can anyone tell me what it means and how to fix it?
Both of you, On the data tab what station does it show in the lower right corner?  You can also look under the advanced tab for stationid.  I can look it up to see what data the api returns.  I feel the problem is probably with the api or that particular station but would like to investigate it.  Sorry for the delay. I never got an update notification.
Title: Re: Virtual Rain Sensor
Post by: copekyle on August 04, 2015, 11:46:47 am
My station ID is KUTHYDEP3 ... The message has cleared itself already though.  Is this message saying that it is just having trouble getting info from the API? 
Title: Re: Virtual Rain Sensor
Post by: blakem on August 04, 2015, 04:20:32 pm
My station ID is KUTHYDEP3 ... The message has cleared itself already though.  Is this message saying that it is just having trouble getting info from the API?
Thanks for your reply. It looks like it is the personal weather station that was not reporting any data(observations) on July 11th.  The plugin gives an error anytime it is unable to so something to let you know it is having trouble. You should only be concerned if it keeps coming back, but it is an issue with that station.

I assume it is the same problem with Robert.

Also I hope in the future to include anhman's changes
Title: Re: Virtual Rain Sensor
Post by: kiber111 on December 08, 2015, 05:16:58 am
I read the topic and found no answer ....
help me please
I need to:
Now the rain - tripped
Now the rain stops antripped
how to setup??
Title: Re: Virtual Rain Sensor
Post by: bergymen on August 05, 2016, 11:31:56 am
I am getting the error: VRainSensor : Error, precip section not found in conditions data.
My key is valid and I tried updating the precipitation data a few time with always the same error.
is it possible to fix it?
thanks
Title: Re: Virtual Rain Sensor
Post by: Mike Yeager on August 05, 2016, 04:31:18 pm
Any chance you would be willing to modify this and re-release it to work with ForecastIO? It allows 1000 calls a day and I use it for my weather now...
Title: Re: Virtual Rain Sensor
Post by: WokingWounded on September 02, 2016, 10:58:05 am
Is there a way to install two instances on my Edge? Otherwise I can't see a way to have two trips: one short term with a low threshold and another with a longer term with a higher threshold.
Title: Re: Virtual Rain Sensor
Post by: theal on September 27, 2016, 05:18:50 pm
Hi
Is there a way to enable an email alert when a station stop reporting?

Thanks!
Title: Re: Virtual Rain Sensor
Post by: Mike Yeager on September 28, 2016, 08:21:38 am
Is there a way to install two instances on my Edge? Otherwise I can't see a way to have two trips: one short term with a low threshold and another with a longer term with a higher threshold.

You could use a virtual switch for the longer hold and use a timed condition to clear it. That's basically what I'm doing.
Title: Re: Virtual Rain Sensor
Post by: gregreid on March 23, 2017, 07:37:52 pm
I've been running Virtual Rain Sensor to fire two triggers, called "insufficient rain" and "sufficient rain" (based on my thresholds, using the past 2 days actual rain and the current and next day's forecast rain).  Those triggers in turn drive scenes which either turn off or on a Zwave switch that is in series with my lawn irrigation system timer relay.  The net result is that I don't irrigate if sufficient rain has occurred or is forecast. 

This has been working great for some years now.  But recently, I notice that it's been throwing an error ever time it has run: "VRainSensor : Error, observation precip section not found in history data."   Looking back in the trigger history, it seems that this failure started on "pie day", March 14 (03/14).

I saw some similar errors reported in this forum, that seemed to be fixed by updating the VRS's WUG station or location so that a non-private reporting station would be used, so that WUG would provide the historical data.  I've played around with this, using several different available stations by name, but always the same error ... missing the historical data.

As I was poking around the WUG website's API section, under my "Key settings" page, in the pricing options, they now have a "History add on?" header with a link to "Get in touch if you would like access to our history data."     Well I clicked on that link and followed the directions (as a free user with fewer than 10 hits per day to their API) to submit my request for history data for my API key.  I filled in lots of information about how I'm using it in their Comments Section for that submission. 

I don't know how long it's supposed to take for me to receive a response on this, but hopefully it will be quick and positive.  I'll update this posting once I get approval (or not), and whether or not it resolves my Virtual Rain Sensor error.
Title: Re: Virtual Rain Sensor
Post by: Mike Yeager on March 25, 2017, 12:23:52 pm
You can always store the data yourself for the few days of historical data you're looking for. These services think they can extract money from everyone for every little thing and, in the end, they'll realize they can't...
Title: Re: Virtual Rain Sensor
Post by: blakem on March 25, 2017, 12:43:28 pm
I am not aware of any changes to the API but yes you need a developer API key that will allow access to the history section. There is no need to track anything locally.  It will query the history for the station you select. There are sometimes problems when the station goes offline there will be missing information on the day and it will throw that error. It should show NA on the data tab for that day if I remember correctly.  Let me know how it works out. This plugin should still work but I know there are changes on UI7 and this was developed on UI5.

Sent from my A0001 using Tapatalk

Title: Re: Virtual Rain Sensor
Post by: Sender on April 07, 2017, 11:05:43 am
Oops, no... Since today:
VRainSensor : Error, observation_location section not found in current conditions data. in blue vera top of screen line  :-\

Login with wunderground.com gives me:
JSON.parse: unexpected character at line 1 column 1 of the JSON data

Could be a problem there...?
Title: Re: Virtual Rain Sensor
Post by: gregreid on May 03, 2017, 02:22:54 pm
Quote
This plugin should still work but I know there are changes on UI7 and this was developed on UI5.

FYI, I upgraded a few days ago from my Vera3 (UI5) to VeraPlus (UI7), and am happy to report that the Virtual Rain Sensor (version 3.2) is working beautifully.

My earlier "missing historical data" problem just went away on my Vera3 earlier.  I'd forgotten to check when exactly it corrected itself.  But in the meanwhile I purchased and set up my own weather station connected to the Weather Underground (https://www.wunderground.com/personal-weather-station/dashboard?ID=KFLPORTO34 (https://www.wunderground.com/personal-weather-station/dashboard?ID=KFLPORTO34)), which I may have automatically granted me "Historical Data" capability.  I really don't know what fixed it, but it's fixed now anyway...

... and remains fixed in my upgrade to VeraPlus UI7.  I have my Virtual Rain Sensor configured to check the prior 3 actual rain and future 3 day forecast, with a trigger on 0.5 inches total.  And it's working great.

Greg
Title: Re: Virtual Rain Sensor
Post by: williams2353 on May 26, 2017, 04:21:25 pm
Trying to update the Virtual rain Sensor, I have been using 2.2, on VeraLite and UI5. 

Couldn't figure out how to upgrade, so I decided to re-install.  The uninstall button on the apps.mios.com page did nothing, so I decided to delete the app and install it again.  Now the situation is virtual rain sensor is gone from my system, but the apps.mios.com page still reports that is is installed, and the uninstall button still doesn't work.

Is there a way to install this app manually?

Thanks,
Tom
Title: Re: Virtual Rain Sensor
Post by: blakem on May 26, 2017, 04:31:51 pm
I would try to do a reboot or power off and see if it allows you to either continue the uninstall or allows you to install.

Sent from my A0001 using Tapatalk

Title: Re: Virtual Rain Sensor
Post by: anyra on May 26, 2017, 08:11:03 pm
I have a scene in UI7 that start my sprinklers at some time on the day on some days of the week. My scene has a simple trigger "schedule"
Now I know that you can add a specific code "to the trigger", and here is where I liked to use the plugin.
I already have it installed and is giving me accurate info about the rain for the past 2 days.
So basically the condition hast to be to fire the trigger scheduled only if the Virtual Rain Sensor is not tripped.
My question is how this code will be, because I couldn't make it work with the examples at the beginning of this thread
Thank you for the help
Title: Re: Virtual Rain Sensor
Post by: blakem on May 26, 2017, 08:19:32 pm
I am not on UI7 yet so I cannot answer but it sounds like you have the right idea.

Sent from my A0001 using Tapatalk

Title: Re: Virtual Rain Sensor
Post by: icare on May 27, 2017, 02:53:00 pm
The following code I use to switch ON/OFF the sprinkler based on a start/stop schedule and treshold set in vrain plugin:
-- Get current status sprinkler switch
local switch_status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", id_sprinkler)

-- If switch is ON THEN switch it off
if (switch_status == "1")
then
-- Turn Sprinkler OFF
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, id_sprinkler)
return true
else
--Switch Sprinkler ON depending on vrain
--Force update virtual rain sensor(this step optional)
luup.call_action("urn:upnp-org:serviceId:VRainSensor", "Update", {}, id_vrain)
--Get current state virtual rain sensor
local rain = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped", id_vrain)
if (rain == "0")
then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },id_sprinkler)
-- Register action in database
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "3"}, 0)
return true

else
return false
end
end
Title: Re: Virtual Rain Sensor
Post by: williams2353 on May 27, 2017, 03:47:44 pm
"I would try to do a reboot or power off and see if it allows you to either continue the uninstall or allows you to install."

I tried that, still no luck.  Also tried a different browser, same results.


Title: Re: Virtual Rain Sensor
Post by: williams2353 on May 28, 2017, 08:38:51 am
Here is what the apps.mios.com page returns when I try to uninstall the Virtual Rain Sensor:

Title: Re: Virtual Rain Sensor
Post by: rjspindler on July 17, 2017, 11:20:55 am
Icons not displaying, please advise.  Installed app v3.2 on VeraEdge/UI7 from the Install Apps menu.
Title: Re: Virtual Rain Sensor
Post by: kwieto on September 11, 2017, 09:15:34 am
I have the same problem - no icon displaying
Title: Re: Virtual Rain Sensor
Post by: rafale77 on September 11, 2017, 01:18:07 pm
I have customized this app with my own icons. I did not like the default ones but it appears the that they are also no longer reachable. I suspect the server hosting them is down. Try uploading this file into the apps/develop apps/luup files. You will be pulling the icons I am hosting.
Title: Re: Virtual Rain Sensor
Post by: m13kern on November 15, 2017, 01:05:33 am
Hi, I have the same issue; no icons.

I have my own icons I would like to use but am new at this, what do you need to change on the code (It enters them into a default directory I have read) and how do you load just the icons into a directory?

Thanks in advance
Title: Re: Virtual Rain Sensor
Post by: halo on April 23, 2018, 02:25:41 pm
Hi,

Just wondering, if it is possible to present this plugin in ImperiHome?
Currently plugin is not recognized by ImperiHome.
Title: Re: Virtual Rain Sensor
Post by: rafale77 on April 23, 2018, 03:24:47 pm
Hi, I have the same issue; no icons.

I have my own icons I would like to use but am new at this, what do you need to change on the code (It enters them into a default directory I have read) and how do you load just the icons into a directory?

Thanks in advance

Missed this question. Sorry if it is a bit late. Look into the json file I posted. All you have to do is to change the "img:" line and modify it to point to the icon you want. It can be either local on your vera or remote through a web host. I chose the latter. If local I recommend you type the full path.
Title: Re: Virtual Rain Sensor
Post by: rafale77 on May 09, 2018, 11:51:54 am
I discovered a potential bug coming from the wunderground API. For the station I chose, it intermittently sends data from the past which causes the plugin to get wrong information.
Specifically I often get TodaysDate as 1/3/2018 while we are in May. I have made some changes to the plugin so that the time update polled from the API cannot go back in time. PM me if anybody wants it.

Edit:

As posted in various forums, the WU API frequently sends garbage data with wrong dates and some times wrong forecast. When this happens the VRainSensor is wrongly tripped and can lead your plants to dry up if you rely on it for your irrigation. :).

I modified the plugin in order to make it even more resilient. It will not update it's data if it get's garbage out of the API and instead will retry every minute until it gets good data. I tested it on Openluup but should have no problem working on UI7.
Title: Re: Virtual Rain Sensor
Post by: Ryanoc75 on May 20, 2018, 09:08:54 pm
Hey Raf,

  Thanks for making those changes.  To install, should I assume I just unzip open the Openluup folder and then drag and drop all 6 files in Develop Apps - luup files - upload files.  Is the D_VrainSensor.json file in that folder the same as the one 2 posts before?

Thanks   
Title: Re: Virtual Rain Sensor
Post by: bwillette on May 20, 2018, 10:15:45 pm
As posted in various forums, the WU API frequently sends garbage data with wrong dates and some times wrong forecast. When this happens the VRainSensor is wrongly tripped and can lead your plants to dry up if you rely on it for your irrigation. :).

I modified the plugin in order to make it even more resilient. It will not update it's data if it get's garbage out of the API and instead will retry every minute until it gets good data. I tested it on Openluup but should have no problem working on UI7.

Thank you so much for contributing this back. I?ve been having problems related to this as well!
Title: Re: Virtual Rain Sensor
Post by: rafale77 on May 21, 2018, 01:30:59 am
Hey Raf,

  Thanks for making those changes.  To install, should I assume I just unzip open the Openluup folder and then drag and drop all 6 files in Develop Apps - luup files - upload files.  Is the D_VrainSensor.json file in that folder the same as the one 2 posts before?

Thanks   

I would recommend replacing all the files with the ones in the Zip file just to be sure even though I don't think I made any changes to the device json. All the files belong in the same folder indeed. Unless you installed openLuup elsewhere, it should be in /etc/cmh-ludl
Title: Re: Virtual Rain Sensor
Post by: pit on June 03, 2018, 07:52:03 am
Last time the one or the other of the wunderground-updates during a day delivers wrong values. In this cases the field "TodaysDate" is wrong (at this time 1/3/2018).
So the trip/untrip result is wrong.

I didn't want to change the original app. Instead I addded a lua check into the scene switching the irrigation system (-> if TodaysDate is wrong then ignore the change of trip):

local TodaysDate=luup.variable_get("urn:upnp-org:serviceId:VRainSensor","TodaysDate",<deviceNr>)
local m=os.date("%m")
local M=tonumber(m)
local d=os.date("%d")
local D=tonumber(d)
local sArg=mySplit(TodaysDate,"/")
if M ~= tonumber(sArg[1]) or D ~= tonumber(sArg[2]) then
 return false
end
Title: Re: Virtual Rain Sensor
Post by: rafale77 on June 03, 2018, 12:00:19 pm
Last time the one or the other of the wunderground-updates during a day delivers wrong values. In this cases the field "TodaysDate" is wrong (at this time 1/3/2018).
So the trip/untrip result is wrong.

I didn't want to change the original app. Instead I addded a lua check into the scene switching the irrigation system (-> if TodaysDate is wrong then ignore the change of trip):

local TodaysDate=luup.variable_get("urn:upnp-org:serviceId:VRainSensor","TodaysDate",<deviceNr>)
local m=os.date("%m")
local M=tonumber(m)
local d=os.date("%d")
local D=tonumber(d)
local sArg=mySplit(TodaysDate,"/")
if M ~= tonumber(sArg[1]) or D ~= tonumber(sArg[2]) then
 return false
end

Interesting but this does not help you get the correct data until the next poll and still gives you the wrong status on the device. Why not update the plugin instead?
Title: Re: Virtual Rain Sensor
Post by: pit on June 04, 2018, 09:46:18 am
I've tried to get correct data with a sudden manual update, but this didn't work immediatetely in all cases -and there is a time limit for updates. So my way is to ignore incorrect data untill a poll delivers correct data.

The wrong state on the virtual rain sensor device is not a problem for me. Critical for me is the state of the relay switch, which controls the irrigation system. Ths relay switch is triggered by all trips/untrips of the virtual rain sensor, but only changed if the TodaysDate in that moment is correct.
Title: Re: Virtual Rain Sensor
Post by: rafale77 on June 04, 2018, 11:42:12 pm
I've tried to get correct data with a sudden manual update, but this didn't work immediatetely in all cases -and there is a time limit for updates. So my way is to ignore incorrect data untill a poll delivers correct data.

The wrong state on the virtual rain sensor device is not a problem for me. Critical for me is the state of the relay switch, which controls the irrigation system. Ths relay switch is triggered by all trips/untrips of the virtual rain sensor, but only changed if the TodaysDate in that moment is correct.

Well the whole purpose of the update is to avoid doing this. It will retry to get the new data every minute until it gets it and you do not need to use some complicated code to ignore the bad data in your Luup scene. You also don?t need to stop your irrigation from turning on when the data is incorrect since you have obtained correct data before so it will use the previous dataset until it gets a new valid one.
Title: Re: Virtual Rain Sensor
Post by: nelieto060 on June 22, 2018, 07:37:15 am
I don't have an answer for you. But I am suggesting some rain sensor (https://www.smartsprinklercontroller.com/best-rain-sensor-for-sprinkler-system/) which can give you an accurate result.
Title: Re: Virtual Rain Sensor
Post by: nelieto060 on June 22, 2018, 07:41:26 am
I don't have an answer for you. But I am suggesting some rain sensor (https://www.smartsprinklercontroller.com/best-rain-sensor-for-sprinkler-system/) which can give you an accurate result.
Title: Re: Virtual Rain Sensor
Post by: unissani on September 12, 2018, 08:05:08 am
Hi,
is this service from Wunderground no longer free?

https://www.wunderground.com/weather/api

"To improve our services and enhance our relationship with our users, we will no longer provide free weather API keys as part of our program. If you have been directed to download our Weather Underground free API key by a third party provider, please contact your vendor for resolution"

Any alternative?
Thanks
Uri
Title: Re: Virtual Rain Sensor
Post by: jswim788 on September 12, 2018, 02:09:39 pm
If you already have an account it appears to continue working for now.  If you don't have an account, see: http://forum.micasaverde.com/index.php?topic=84948.0

OpenWeather and DarkSky appear to be the top 2 choices.
Title: Re: Virtual Rain Sensor
Post by: Mike Yeager on September 13, 2018, 04:13:36 pm
I use DarkSky with a 2 minute polling interval. It's quite accurate for my needs and I've even coded a variable rain delay for the irrigation system off of it. I'd be happy to share it, but you'd have to re-engineer it for Vera as I've moved that off to my Home Assistant instance.
Title: Re: Virtual Rain Sensor
Post by: icare on March 07, 2019, 09:17:15 am
As a PWS uploading to wunderground, I have been furnished with a new key. However, the new API key is  32 characters long. The older key format was only 16 characters long. Using the new key, the sensor reports back "wrong-key" although the key is functioning in the following statement:
https://api.weather.com/v2/pws/observations/current?stationId=STATIONID&format=json&units=m&apiKey=32charlong
Is there is format restriction built into Vtainsensor inhiiting from accepting the new key?
Title: Re: Virtual Rain Sensor
Post by: warren64c on March 09, 2019, 05:19:01 pm
Has anyone figured this out?  I have the same problem not accepting a longer key.....
Title: Re: Virtual Rain Sensor
Post by: HSD99 on March 09, 2019, 07:14:44 pm
As a PWS uploading to wunderground, I have been furnished with a new key. However, the new API key is  32 characters long. The older key format was only 16 characters long. Using the new key, the sensor reports back "wrong-key" although the key is functioning in the following statement:
https://api.weather.com/v2/pws/observations/current?stationId=STATIONID&format=json&units=m&apiKey=32charlong
Is there is format restriction built into Vtainsensor inhiiting from accepting the new key?
How did you get your new key? I also have a PWS uploading to WU.
Title: Re: Virtual Rain Sensor
Post by: rafale77 on March 10, 2019, 11:36:19 pm
As of March 5th The WU service completely stopped working so my plugin has been disabled. When I get the time in the spring, I may try to get this plugin to connect to another service. I don't really have the time needed to work on it right now.
Title: Re: Virtual Rain Sensor
Post by: HSD99 on March 11, 2019, 01:58:33 pm
As of March 5th The WU service completely stopped working so my plugin has been disabled. When I get the time in the spring, I may try to get this plugin to connect to another service. I don't really have the time needed to work on it right now.

Same here. Last update was March 5.
Title: Re: Virtual Rain Sensor
Post by: Don Phillips on March 11, 2019, 08:00:11 pm
I had the same experience. I am using the Virtual Temperature plug-in since that is critical for thermostat heating/cooling setting in PLEG. With a predicted high of 68F Thursday, I expect the thermostat will change to cooling mode. 

The sky conditions was helpful for turning on/off exterior lights earlier/later when cloudy or rainy. I ended up removing the WU plug-in altogether.

If someone can figure out how to get to the sky conditions data in Vera, that would be awesome.
Title: Re: Virtual Rain Sensor
Post by: Mike Yeager on March 12, 2019, 12:09:53 am
Use DarkSky. You can poll the API every 3-5 minutes and it gives you all the data you need...
Title: Re: Virtual Rain Sensor
Post by: warren64c on March 14, 2019, 10:12:05 pm
OK I have Dark Sky polling data but how do I create a rain sensor device using it?  Now it shows virtual devices for temp, pressure and humidity only.  Wonder how hard to modify the virtual rain sensor...
Title: Re: Virtual Rain Sensor
Post by: Mike Yeager on March 15, 2019, 05:41:08 pm
You have to create your own. If you know how to view all the data variables, find the rain probability variable and the precipitation intensity and use PLEG to turn a virtual switch (or a virtual sensor) on and off. I don't remember exactly how I had mine but since I abandoned it a while back, I can't look either...
Title: Re: Virtual Rain Sensor
Post by: rafale77 on March 22, 2019, 07:27:07 pm
I am looking to adapt the VRainsensor plugin to poll the darksky plugin. Unfortunately, the DarkSky API does not provide the same level of precipitation details as weather underground. This will take some work... I will get to it eventually.
Title: Re: Virtual Rain Sensor
Post by: warren64c on March 24, 2019, 10:13:58 pm
I noticed the datafeed seemed sparse on  precipitation data.  Thank you......