bbernstein / homebridge-snowsense

Senses when it's "snowy", meaning it snowed recently or will likely snow soon
Apache License 2.0
4 stars 1 forks source link

Put IsSnowing back #23

Closed sbguy02 closed 1 year ago

sbguy02 commented 1 year ago

Hi bbernstein.

Thank you so much for this very useful app. I use it to control my heated driveway, which needs to be turned on 3-4 hours before snowfall. It has been working flawlessly for the past few months. I also use it to control my HeatTrak heatmats.

I noticed in the latest version, you deleted the IsSnowing sensor. I find that my heatmats work perfectly triggering off of the active snowing signal -- IsSnowing. It heats up really fast and don't need a rampup period. So with the current IsSnowy signal, I'm wasting hours of electricity prior to and after active snowfall.

Would appreciate if you put IsSnowing back in.

Thanks!

bbernstein commented 1 year ago

My intention is that you can set hoursBeforeSnowIsSnowy and hoursAfterSnowIsSnowy to zero, then that will be the equivalent of only turning it on while it is snowing. I was trying to simplify so that the one sensor could be flexible enough for all the use cases.

Let me know if that doesn't work and I'll see if I can bring back the separate sensors quickly. I can imagine a world where we have multiple sensors with different parameters, where one doesn't look at hours before or after the snow, and another one might be one that only starts after it stops snowing, etc.

sbguy01 commented 1 year ago

Because your plugin works so great, I had it controlling BOTH my heated driveway and heated mats.

Driveway needs hoursBeforeSnowIsSnowy=3 Heatmat needs hoursBeforeSnowIsSnowy=0

Since I can't set 2 different hoursBeforeSnowIsSnowy settings, I need the IsSnowing sensor back :-)

Thanks!

bbernstein commented 1 year ago

ooh, that's a good point. I will do some more work on it to allow multiple sensors, so you can set up any number of sensors and name them what you want and then set each one up differently.

Then you can make a "Snowing Now" sensor as well as "Snowed Recently" and custom names like "Driveway Snow Sensor" and "Heated Mats Sensor" so we don't need to figure out what it means by "snowy".

sbguy01 commented 1 year ago

Wow, that would make it very flexible. Hopefully not too flexible that it becomes complicated :-).

bbernstein commented 1 year ago

I just released a new beta: 2.0.5-beta.9

This one lets you configure multiple "Sensors" in the settings. Give it a try and let me know what you think. I hope it's not too complicated.

sbguy01 commented 1 year ago

Hmm... not sure how to play with a beta plugin. I'm a Homebridge UI kind of guy.

bbernstein commented 1 year ago

I'm using the Homebridge UI also. You can install the beta by clicking the little Wrench icon near the right side of the plugin box and select "Install alternate version", then choose the beta version.

I just released b10 which will now save past forecasts to a file so that if you restart, it will be able to see recent changes in the weather rather than only storing it all in memory that gets lost between restarrts.

sbguy01 commented 1 year ago

Easy peezy. Thanks for the advice. I just created a Driveway Sensor and a HeatMat Sensor. Let's see how it works. It's snowing right now!

So if I want the Heatmats to come on only when it's actively snowing and off when it immediately stops snowing, I just set all the sensor settings to 0 - correct?

bbernstein commented 1 year ago

You are correct, 0 hours before and 0 hours after means it will only turn on if it is currently snowing.

I am excited to hear how it works for you. If you turn on "Debug loggin" in the advanced settings, you'll see in the logs what it is getting for the past, future, and current forecasts so you can see how it's choosing to turn it on and off and you can check that it's doing what you expect.

bbernstein commented 1 year ago

I just added some cleaner debugging to make it easier to see what's happening in the logic.

When Advanced Settings > Debugging is turned on, you'll see messages like this whenever the latest forecast is read.

It shows what we saw in the past 6 hours (negative numbers) and what the forecast shows currently (zero) and in the next 6 hours. The "SNOW/nosnow" value takes into account the onlyWhenCold and temperature settings. Then the values below that show the values it uses to determine if each sensor will get switched. Finally it shows what it is setting each sensor "true" or "false".

[12/03/2023, 13:08:20] [Snow Sense] reports 
∆Hour  Snow  
-5.139 nosnow
-4.139 nosnow
-3.139 nosnow
-2.139 nosnow
-1.139 nosnow
-0.139 nosnow
0      nosnow
0.861  nosnow
1.861  nosnow
2.861  nosnow
3.861  nosnow
4.861  nosnow
5.861  nosnow
[12/03/2023, 13:08:20] [Snow Sense] values {
  snowingNow: false,
  lastSnowTime: 23.139000833333334,
  pastConsecutiveHours: 1,
  nextSnowTime: undefined,
  futureConsecutiveHours: 0
}
[12/03/2023, 13:08:20] [Snow Sense] result for Snow Sensor false
[12/03/2023, 13:08:20] [Snow Sense] result for Snowing Now false

New beta 12 was just released if you want to try it.

sbguy01 commented 1 year ago

Yes, much clean debug log. Thanks!

The beta seems to be working well during the past week of snow storms (based on visual observation)

bbernstein commented 1 year ago

thanks for your help. I'll get ready to promote the latest beta to be the next release

bbernstein commented 1 year ago

released version 2.0.5 which resolves this issue