OpenSprinkler › Forums › Comments, Suggestions, Requests › Show next start time for sprinklers in main display
Tagged: MagicMirror module
- This topic has 11 replies, 4 voices, and was last updated 4 years, 5 months ago by johnny.
-
AuthorPosts
-
November 3, 2016 at 1:52 pm #44464
skyynetParticipantI’d like to show the next start time of each sprinkler and if it will run or not (because of weather forecast or rain sensor) in my home automation display.
Thus I read the values via OpenSprinkler’s API controller variable ps which shows program index (pid), remaining water time (rem) and start time (start). I also read the rd variable to check if the station will run.Unfortunately the content of start is not shown if no station is running.
Could this behavior be changed to have start always show the next start time? I see no disadvantage.
Showing it in the main web page of OpenSprinkler would also be nice.November 6, 2016 at 10:53 am #44482
RayKeymasterDid you check the Program Preview feature? This is available in the app / web interface. From it you can see when the next station run will start, and the program preview does take into account weather.
November 6, 2016 at 6:29 pm #44484
skyynetParticipantYes I know that I can see it in the program preview screen on web / app. I just query the values via API with PHP and I think it makes no sense not to show the next running time in the main “sprinklers” screen while showing it when ONE sprinkler is active.
November 7, 2016 at 4:00 pm #44502
RayKeymasterIt’s a bit tricky for the controller to keep track of this variable and report it. The reason is that this would require the controller to search through time to find the next program start time, and the next start time might be days away. Also it has to do this repeatedly to accommodate dynamic events. The preview is much better suited for this because it runs software simulation of the scheduling algorithm in your browser / on your phone, so it eliminates the need for the controller to run this computation.
Technically the controller does NOT represent program events as a calendar (that would require too much resources that the microcontroller-based OS does not have). Instead, every minute it uses the current time to check against the programs to find out whether the program should run or not. To find out the next start time, the controller needs to step through time minute after minute to find out the next time a program would run, which is computationally expensive.
November 9, 2016 at 8:23 am #44554
skyynetParticipantI see. So I have to read jp (start & dur) to get the start time and duration and calculate the next time by matching with current time.
November 14, 2016 at 9:11 am #44578
DavidParticipantHey,
did you have a working function for this?
Can you post it, please.
Thanks.
November 16, 2016 at 4:40 am #44602
skyynetParticipantWell, I have a PHP code that seems to work but want to test it first for some time.
Also the code might make a structured oo programmer’s head explode.
I’ll post it when I have tested it a little. Just wrote it until now.Currently looks like this:
Attachments:
November 16, 2016 at 6:19 pm #44611
DavidParticipantlooks god,
it finds the next startingtime.if it works fine: just post it. 🙂 so i can add this to the pebble App.
November 22, 2016 at 4:10 am #44712
skyynetParticipantI verified it a few days and it seems to work. My code will definitely not please structured oo programmers but it works and sometimes it’s easier to optimize things than create them in the first place. I also commented it so it should be readable somehow. This sprinkler status display is part of my infoscreen which runs on an iPad 1 in our house.
sprinkler.php creates the display and loads sprinkler_content.php periodically.
Due to my personal usage the script only shows three stations on two programs which run in the morning and evening. My stations run 1,2,3 in the morning and 1,2,3 in the evening. If you have more stations, you’ve got to add them to the code or query the api for the max number of stations and loop through. The same happens for the programs. If you have more than two programs you have to adapt the script.I have setup a rain delay when the weather report indicates rain. The script queries the rain delay bit and changes the big image to one that shows a closed sprinkler with rain above. While running the small water drops in front of each station are animated and the remaining watering time is shown.
Of course you have to change the URL and the OpenSprinkler password in the beginning to reflect your home setup.
Have fun!
Attachments:
November 28, 2016 at 9:16 am #44768
DavidParticipantNice, thank you.
i need some day to look a the code.
Maybe i impelment this in the winterholidays. 🙂
You could add this to the OpenSprinkler App.
Or with the your running PHP version you could wirte a module for a SmartMorror (like https://magicmirror.builders/)
November 29, 2016 at 4:10 am #44783
skyynetParticipantAs I don’t use a SmartMirror but only an iPad I don’t need to rewrite my code. As mentioned it depends on some assumptions which will not fit everyone. But maybe some parts of the code are interesting if someone wants to write his own. If someone optimizes parts (which is definitely possible!) I’m happy to read about it.
May 5, 2020 at 3:24 pm #65719
johnnyParticipantJust uploaded a MM module that supports OpenSprinkler. It connects to the demo.opensprinkler.com by default. Still needs lots of enhancements but it works.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Comments, Suggestions, Requests › Show next start time for sprinklers in main display