Four Seasons PlugIn

I have reached out to try to find out how to get a developers kit for apps, but no response.

I am looking to develop an app that will (similar to Day/Night) tell me if it is Spring, Summer, Autumn or Winter. My house is in South Florida and there are really four discreet seasons.

Spring - Hot and Dry(ish)
Summer - Hot and Rains nearly every day
Autumn - Hot and rains occasionally
Winter - Mild (sometimes cool) and dry

I’d like to have scenes look at the season and modify the behaviour of my automation accordingly. I feel that a lot of folks could use this capability, regardless of their latitude.

This seems simple, so I am putting it out there to see if anyone can assist.

My problem with using the Variable Container App is that I cannot figure out how to switch the season EVERY year. It seems like Vera only likes absolute dates (i.e. a moment in a particular year).

Any suggestions?..

You can set schedules in PLEG that cover a range of dates with a wildcard year. It would be simple to create four schedules to cover the seasons.

Alternatively you could use Lua in a scene to decide when the season has changed:

local tNow = os.date("*t") local dayofyear = tNow.yday if (dayofyear >= 79) and (dayofyear < 172) then season = "Spring" elseif (dayofyear >= 172) and (dayofyear < 266) then season = "Summer" elseif (dayofyear >= 266) and (dayofyear < 355) then season = "Autumn" else season = "Winter" end

See this for more information on using Lua in scenes.

Awesome cheat @RexBeckett. Stupid literal me was wasting cycles thinking about how to calculate solstices and equinoxes with offsets based on latitudes.

I don’t really understand how this would actually be useful for home automation.

Awesome cheat @RexBeckett.
I shall choose to take that as a compliment, @Z-Waver.
I don't really understand how this would actually be useful for home automation.
Nor do I. There is no part of my logic that needs to know the season. If it's cold, I want heat. If it's hot, I want cooling. If it is before or after the Summer solstice, I want a beer. ;D

[quote=“RexBeckett, post:4, topic:178423”]

Awesome cheat @RexBeckett.

I shall choose to take that as a compliment, @Z-Waver.[/quote]

I absolutely meant it as a compliment! Highest regards.

thanks Rex!

I wasn’t aware of the dayofyear and appreciate your help. Its a great approach.

I’m still gong to work on that app…

I'm still gong to work on that app...
Don't let me stop you if you want to learn how to write plugins but it doesn't seem worth the effort for this application. If you put the above code into your [i]Startup Lua[/i] you can use the variable [i]season[/i] in any scene as easily as you could get the value from your plugin - actually it would be much quicker.

[quote=“RexBeckett, post:4, topic:178423”]

I don’t really understand how this would actually be useful for home automation.

Nor do I. There is no part of my logic that needs to know the season. If it’s cold, I want heat. If it’s hot, I want cooling. If it is before or after the Summer solstice, I want a beer. ;D[/quote]
Probably on the right track. I’m guessing it is intended to modify irrigation scenes.

If you live in a part of the world that begins seasons at astronomical events (solstice/equinox) and you want that level of precision, you might want to cannibalize code from the Heliotrope plugin. It’s the “right ascension” variable you want. 0 to 6 is spring; 6 to 12 is summer; and so on*. All you’d have to do is modify the D_*.json file to change what it displays. You could even get fancy and make the icon change according to the season.

  • Adjust for your hemisphere if necessary.

Nice idea…

On the subject on the seasons and the visual icon @fuztle mentions, I’ve often thought if it could help to have something that showed if it was MORNING, AFTERNOON, EVENING (Each could be set the users own range by a time range)

Turn the lights on in the Morning and evening but not the afternoon.

I know PLEG can do this, but this thread has made me think if there was an enhancement to the day and night plugin that gave you access to those daily terms that a household often refer to as variables

Day, night,
morning, afternoon, evening, (based on times of the day)
spring, summer, autumn, winter, (based on periods within the year)
Light, dark, (based on light sensors ranges)
hot, cold, warm etc. (based on temp sensor ranges - one for inside and another for outside )
Occupied, Empty (based on occupancy/motions sensors)

Many of these will be personalised to the user/household, allowing them to choose any combination of the above.

E.g. If the house is occupied, and it’s cold inside and it’s the morning do XYZ.

Anyway I’m just thinking out loud. :wink:

[quote=“parkerc, post:10, topic:178423”]Day, night,
morning, afternoon, evening, (based on times of the day)
spring, summer, autumn, winter, (based on periods within the year)
Light, dark, (based on light sensors ranges)
hot, cold, warm etc. (based on temp sensor ranges - one for inside and another for outside )
Occupied, Empty (based on occupancy/motions sensors)

Many of these will be personalised to the user/household, allowing them to choose any combination of the above.

E.g. If the house is occupied, and it’s cold inside and it’s the morning do XYZ.[/quote]
I see these as simply labels for schedules and other variables that, as you said, we can already do. I just can’t imagine a scenario where another plugin, or even an altered plugin, would provide any benefit over the existing tools. My lack of vision strikes again, I suppose. I’m not saying you’re wrong or that you shouldn’t, I just can’t see the scenario that needs it.

E.g. If the house is occupied, and it’s cold inside and it’s between the hours of Sunrise and 11:00, a.k.a. morning, do; “Turn on the heat and stop mucking about! Why can’t we just have a thermostat like everyone else?”

@z-waver

Bah-humbug :wink:

I know what your saying though, and I’ll admit my example was perhaps not the best but I like thinking out loud… ;). However terms such as ‘day’ and ‘night’ are quite well embedded into what we do with Vera nowadays.

Hence taking that one step further, my curiosity took over and I wondered if there was any value in having other calculated human terms (such a those I listed earlier) that people could then simply refer to them.

So in my head I was thinking that you could have a single plugin that listed all of these terms, each one backed off by a config tab where you specify how they are defined/tripped and then you could reference them any way you wanted.

Thanks Rex, I put it in my startup and it works well.

Btw, for those who didn’t see the value of having your vera know the season, I can now adjust my irrigation and pool pump automatically based on the season.

Pools in SoFla need less than half the filter time in the winter as in the summer, so now I can adjust
It to 3 hours in the winter, four in the spring 6 in summer and autumn.

I can also adjust the irrigation to water the lawn more frequently in the spring than winter and not at all in the summer.

Thinking this through more, I could have used the length of the day to power the pool (sunrise plus 3 hours until sunset minus 4 hours for example) that would adjust it slowly each day. This will not allow me to take advantage of the irrigation control modification.

Thanks for your assistance and suggestions, much appreciated.