Changes history for App::RPi::EnvUI

0.30    2017-12-21
        - this will be the last beta release. The next release will be 1.00,
          will be stable, and will have proper documentation
        - the env_to_db() Event will now restart itself if it crashes
        - significant modifications to the API action_light() infrastructure...
          we use DateTime objects now, per stevieb9/scripts/perl/light_timer
        - code cleanup
        - fix void assignment of hash in API
        - DateTime objects are now properly set in the class scope for 
        - updated t/50 with newer tests; we now perform tests to ensure that if
          the on/off cycle completes within the same 24 hour period, the next
          "on" time will be pushed to the following day
        - updated the timezone in the src config file and db to 
        - fix issue where in test mode, Events aren't created and stored into
          the API object, therefore calls to Event->status() would fail when
          calling the API->env() method in testing (fixes #48)
        - fixed issue where override was not operating correctly. Fixed Perl and
          JS code (fixes #49)
        - code/test tidying, and all tests now pass ;)
        - fix issue in Auth, where we were calling API::user() by class, not by
          object, broke during recent update to API code. (fixes #50)
        - add API::env_light_aux() and DB::db() to POD
        - added new sig handler for warn with env var SUPPRESS_WARN=1 to quiet
          warnings. Recommended only while testing
        - fix issue where the month in the UI date was off-by-one (fixes #46)
        - renamed "log_level" config file variable to "debug_level"
        - removed config/ from the distribution, and consolidated the testing()
          and _ui_testing() configuration to use the config file in t/ instead
        - added new config directive, "devel", if set to 1, we'll turn the
          background of the time display in the UI red to signify this isn't
          a production system (closes #47)
        - fix logic bugs and other JS weirdness in core.js that was completely
          breaking the UI's interpretation of aux override (fixes #53)
        - rewrite logic in core.js so that if override is disabled, setting aux
          state doesn't happen (fixes #54)
        - disabled "toggle" in the base config file for the light aux (updated
        - updated API::_bool() to allow the $bool param to be both true/false
          and 1/0, as we do call it in both of those contexts, so we don't
          have to translate the param in code before sending it in
        - added new t/226 test for fully testing the set_aux_override route
        - fix issue where when API::switch() was called, we were setting the
          physical pin state even when the state hadn't changed (fixes #52)
        - fix issue where the log_file directive in the config had no effect,
          rendering an empty log file (fixes #56)

0.29    2017-10-24
        - this project is still in BETA status and should not be used in a
          production growing environment without extreme monitoring
        - added DB::delete(), which will remove all data from a table
        - stats DB table is now emptied on webapp load. This will make graphing
          easier (avoid gaps where the app was down)
        - added new stats template and stats.js logic, Statistics in the menu
          load this template for the statistical graphs for temperature and
        - the various templates now have a div id, so that we can combine all of
          our javascript/jquery into a single file
        - switched to $(document).on('pageshow') from $(document).ready() so
          that the appropriate js is executed on specific page loads (see above
        - clean up debugging code in JS
        - implemented more debug logging
        - installer (Makefile.PL) now installs the Dancer2 config.yml file
        - fix the -1 temp/hum from enabling devices on initial page load (work
          on #31)
        - correct significant logging issues. We were initializing the system
          in a way that the log level was not set until long after we've
          performed numerous tasks in API
        - fix issue where on app start, three API objects were being generated
          (closes #36)
        - the fix above (three API objects) was also causing resets of auxs due
          to -1 values. (fixes #31)
        - various log level adjustments
        - fix Configuration POD issue (closes #32)
        - change /time to add prepending zero to hours if the length is < 1
        - we now display both the date and the time in the UI
        - tweaks to the UI button layout, we've switched from label OVERRIDE
          to HOLD, and manipulated the size and indenting (closes #33)
        - we now show a tooltip on the buttoms to inform the user that to make
          changes, they must be logged in. (closes #38)
        - removed Travis CI integration (for lack of SQLite)
        - added blurb about needing to be logged in to make changes (and
          included the default un/pw)
        - bumped prereq of Async::Event::Interval to 0.04 for the updated status
        - added config directive, "event_timeout"
        - updated src db and schema with new directives
        - change to using RPi::Const instead of RPi::WiringPi::Const
          (closes #42)
        - fix documentation for API::action_light() (closes #44)
        - fix override issues (fixes #37)
        - the main page now displays the limits for temp and humidity
          (closes #40)
        - fix issue where the "toggle" config directive for the light aux was
          failing to prevent toggling (we now throw a JS alert). (closes #39)
        - implemented much more robust logging throughout the override call
          chain (closes #29)
        - removed the toggle option from the light config, and instead added
          the option to all auxillary channels

0.28    2016-11-30
        - all updates other than a Makefile.PL file were 0.27. This release is
          just a small correction
        - correct issue where the minute portion of the time was displaying
          only a single digit if minutes were less than 10 (fixes #23)
        - clean up of all sample test files and random test code snips
        - consolodated the JS graph routines into a single function
        - all SQL prepare statements are now only created once, where possible
          (queries where structure elements can be hardcoded)
        - /logout route now redirects back to the home page
        - removed everything related to the water auxs; aux 4 and 5 are now just
          generic, unused auxs now
        - all auxs are now listed in the HTML template (hidden if pin == -1)
        - completely changed the way we track light times. Added
          set_light_times(). It's called once on webapp start, then at the end
          of each light-off event. It's all done with epoch now instead of
          DateTime objects
        - the set_aux route has been broken out into two separate routes:
          set_aux_state and set_aux_override. (closes #30)
        - we now save draggable widget locations if changed from default with
          HTML5's `localStorage`
        - new menu header "System", with sub menu "Reset Layout", resets layout
          to defaults
        - template layout changes
        - JS code restructured entirely; all functions have been moved out of
        - all auxs will now be hidden if the pin is set to -1 in the config/db

0.26    2016-10-25
        - functionality adddition and bug fix beta release
        - DB::auth() now returns a hashref of the username sent in with a blank
          password field if the user doesn't exist (added tests)
        - added light_on() and light_off(), each return a DateTime object with
          with the respective times for each operation
        - action_light() now uses proper DateTime objects for on/off checking
        - _config_light('on_hours') will die if hours is not an integer, is less
          than 0 or more than 24
        - added numerous new tests for new internal functionality and existing
        - cleanup after profiling, shaved startup from 10.7 seconds to ~700ms
          (closes #20)
        - added new drop-down menu system
        - added time to top-right of UI, beside menu, with the same style as the
        - UI now has a basic, alpha set of "draggable" widgets
        - reworked light_off(), it now uses the set 'on_since' flag as it's base
          time, which we simply add 'on_hours' to it
        - added _reset_light() called by _parse_config() after _reset(), resets
          the light 'on_since' flag. If the Pi crashed, the light would be
          deemed already on no matter what, and if it was lights-on time, the
          light would not be re-enabled (fixes #21)
        - extensive work on the authentication mechanisms (the set route
          requires a user to be logged in, or on localhost. Also, jquery
          disables buttons if not logged in)
        - major work on UI enhancements; objects are drag/droppable, and graph
          functionality is well on its way (fixes #24)(new graph_data() methods
          in DB and API, and new /graph_data route)
        - made a feeble attempt at bettering explanations in POD

0.25    2016-10-16
        - separated out API::new() initialization code into _init(), which loads
          _test_mode() or _prod_mode() to make things cleaner (closes #18)
        - the t/15-api.t file was split apart into numerous files, each one now
          tests a specific part of the API (closes #17)
        - due to Event tests needing to mock out certain subs within the test
          file itself (as opposed to API handling this), created a new
          flag/getter & setter "test_mock", which is sent into the API::new()
          when we're testing Event routines
        - test files (other than one that tests Event code) no longer need to
          mock out hardware-based subs themselves. The API now does this in
        - added debug_sensor, log_level and log_file core config directives to
          the Configuration POD
        - aux overrides for temp/humidity now have tests
        - if 'stats' table is empty on first API::env() call, we now return an
          href where the temp and hum are both -1 (added tests as well)
        - fixed an issue where the DB::new() connect() call wasn't able to be
          tested thoroughly (thanks 'NetWallah' from Perlmonks:

        - added a check to ensure we found the config file ok in API
        - added initial user authentication implementation (outside of normal
          run modes for now)
        - added session support (JSON files at this time)

0.24    2016-10-11
        - all modules now have initial draft POD
        - separated out setting/fetching API variables from $self->{} to
        - migrated the API initialization tasks out of new() and into a new
          _init() method
        - all subs in API now alphabetical in public/private sections
        - logging is now configurable via method calls
        - new db() method, sets/gets the db object
        - new testing() method, sets/gets testing
        - replaced all die() calls in API to confess(), makes it much easier to
          track things down

0.23    2016-10-11
        - this update contains changes for 0.22 which wasn't released properly
        - fixed critical bug where each process (events) were sharing a copy of
          the same DB handle (via the DB object stored within the API object),
          which was breaking periodically due to contention. (See

        - added initial logging configuration with Logging::Simple
        - re-wrote light timing logic, and performed basic 12 hour tests for
          proper functionality
        - added several more tests
        - added more error check code
        - events are now started within the API, instead of the Dancer2 app lib
        - reset() now resets override, state and aux_on_time for all auxs on
          app load
        - API::env() now returns a properly structured hashref with values set
          to zero for temp/humidity if the DB doesn't have any statistics data
        - in API, created a $sensor class variable to make it easier to set up
          whether we're in tests or not
        - more work on cleaning up in-module testing functionality, next round
          of changes will focus specifically on this and other code refactoring,
          along with initial draft of documentation for all modules

0.21    2016-10-04
        - had to change version numbers because of a typo in 0.2, which should
          have been 0.02
        - added sensor_pin to core config section in json and db
        - fix issue where wiringPi was being loaded multiple times, breaking
          things. First, set up a check in %INC to see if they've already
          been required, then instead of passing a new API object to each
          event, we now pass in $self instead, so we don't call new() which
          tries to load the wiringPi libraries again
        - the 'envui' app dir now gets placed in the user's home directory, and

0.03    2016-10-04
        - broke out the main components (route-handler, API, DB) into distinct
          abstraction layers making it easy to test specific sections, and use
          the various pieces external from the web app
        - significant amount of test coverage written, particularly for API
          and DB
        - many small bugs corrected, and error checking added while in the
          process of test writing
        - separated testing from prod in API and DB (needs more work)
        - initial work done on using memory-backed databases. For now, they are
          fully implemented in testing
        - temp and humidity limits are now grabbed by jquery from the API, so
          there's no risk of conflict (closes #1)
        - set reasonable real defaults in the default config file (closes #2)
        - we now get the control aux values from the API instead of having them
          specified all over the place manually (closes #3)
        - the "next on" UI display is now updated on each fetch of the aux
          states 9closes #8)
        - in the Makefile.PL in a postamble, we now create a new app dir
          (envui), and copy in the relevant pieces into it on 'make install'
          (closes #10). More work will be needed here
        - default config now has all aux pins set to -1. This is because GPIO 0
          is a valid pin
        - added core config section "testing" directive. This allows unit
          testing on non-Pi boards, and on machines that don't have the wiringPi
          C libraries installed
        - next release will be doc and test focused

0.02    2016-10-01
        - all auxillaries working
        - temp/humidity on/off limits working
        - aux override working
        - min on time working (temp/humidity)
        - light infrastructure added
        - feeding infrastructure added
        - initial pod for configuration
        - dist default config/db
        - graphs added, but don't use live data yet
        - added App::FatPacker build structure

0.01    2016-09-15
        - initial import