This app is for Quebec Hubitat users that have subscribed to Hydro Quebec's Dynamic Pricing. This app will help automate all aspects of maximising the use of this program for every program they offer as of Winter 2024-2025.
This will check and add events based on the program you are subscribed to automatically by using the provided JSON file by Hydro Quebec (new for 2025). Based on these events you can...
Automations for morning and evening events can be widely different.
Have automations run xx number of minutes before the event so that you can bring up the temperature of the house just before the event starts.
Automations when the event starts like turn off switched outlets, bring down the temperature by xx number of degrees, etc.
Put back the home exactly like it was before the start of the event.
Send notifications to your phone for start, end, new events, etc.
Send TTS notifications to your speakers as a reminder.
Turn a single light on or other indicator that you are in an event period.
Disable morning or evening events easily with a switch or virtual switch.
When new events have been detected, the app stops poling the JSON file to save on unneeded traffic/resources.
After a certain time, if no new events are detected by 6pm, it will stop polling and restart the next day.
Pause/Start button for summer time where this program is not needed.
More options coming as; control thermostat scheduler directly from the app (testing to make sure this is possible and can work as expected), decide time when you start poling the JSON file link and for how long until it stops every day. Auto recover and reschedule all current events as any event that is current if the hub is rebooted.
First, thank you Nelson your code is REALLY clean and well commented (one of the best).
I have one SMALL problem: When I run the app for the first time, the app crashes in that condition: The next event is in less time than the PRE-event time. Example: If the event is in one hour and I asked for the thermostats to change in TWO hours then the app crashes. I think it happens only when the first time the state.apiData was not filled. Let me know if I'm wrong.
Could not reproduce this, but then again I was not home to test it in those conditions, will have to check this out but from what I can see, this would definitely be something that would happen on a new install and maybe if settings are changed during an event/pre-event.
I also found the other problem where it used a method that was removed and did not rename to the other one < newPoll() >, this is corrected.
I commented out that section, I was working on it, but then could not test it because I changed my router/WiFi setup for a more robust system and removed the code temporarily, as soon as I get my SONOS speaker back in the game, I will get this working.
Nelson, I'm doing some tests with your app and I changed a bit the code to do so some stuff I'd like. We received another event for tomorrow evening and we already have on for tonight. In my case it doubles the event for tonight in the schedule. Is it your case also or I just bugged your app ?
I think I know why. Is it possible it is because you run at 23:00 after today's events and I run at 11:30 BEFORE today's evening event ? I think it is the problem.
One weird thing is that I did get the push message to the mobile app about new events added, but never got the message that the pre-event had started, waiting to see at 4pm to see if I get a message then. Added a few trace logs to see if it actually gets inside the "if" statement or if I have a bug somewhere that I just can't see?
New update with hub restart recovery and check if within a period when installed.
1.0.4 - 2025-02-05
NEW FEATURE, option to recover after a hub reboot, this will cause all scheduled events to be removed and recheck everything, if within an event period, that event will start immediately
If the app is started or a manual poll of the API is done, if we are within an event period, that event period will start immediately
just installed. seems straight forward.
I already have 2 virtual switches (HQ-Peak-AM and PM) that are triggered (when turned on) to heat up the place, turn light off, turn furnace fan off...
easy install. just turn on those 2 switches on. nothing else. oh, and select FlexD residential.
love it.
looking forward to the next cold days.
side question, you did all that code yourself? or all AI? or a mix of both?
Thanks, new stuff coming this weekend including voice announce over speakers (SONOS is tested and working, will be looking for people that uses Echo Speak and other voice enabled devices), might install echo speaks since I do have like 7-8 echo devices around the house.
Never use AI, I want full control of what I code and understand it, what good making an app that you can't understand how it works and can't improve on. Sure I have snippets of other peoples code (why reinvent the wheel).