App-RPi-EnvUI
view release on metacpan or search on metacpan
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
action_light()
- 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
America/Vancouver
- 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
- 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
tests)
- 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
- 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
functionality
- 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)
- 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
lib/App/RPi/EnvUI.pm view on Meta::CPAN
}
my $aux_id = params->{aux};
my $state = $api->_bool(params->{state});
my $log = $log->child('/set_aux_state');
$log->_5("aux_id: $aux_id, state: $state");
$state = $api->aux_state($aux_id, $state);
$log->_6("$aux_id updated state: $state");
$api->switch($aux_id);
return to_json {
aux => $aux_id,
state => $state,
};
};
get '/set_aux_override/:aux/:override' => sub {
lib/App/RPi/EnvUI/API.pm view on Meta::CPAN
}
sub _set_light_on_time {
my ($dt_now, $on_at) = @_;
my $dt_on = $dt_now->clone;
$dt_on->set_second(0);
$dt_on->set_hour((split(/:/, $on_at))[0]);
$dt_on->set_minute((split(/:/, $on_at))[1]);
if ($dt_on < $dt_now){
# this situation happens if the light on and off times are within the
# same 24 hour period. We check to see if the updated on time is less
# than now; if it is, we need to advance to tomorrow
$dt_on->add(hours => 24);
}
return $dt_on;
}
sub _ui_test_mode {
return -e 't/testing.lck';
}
t/226-route_set_aux_override.t view on Meta::CPAN
is ref $p, 'HASH', "$id ret is a href";
is keys %$p, 2, "$id ret has proper key count";
is exists $p->{aux}, 1, "$id ret aux key exists";
is $p->{aux}, $id, "$id ret has correct default value";
my $aux = aux($id);
if ($_ != 3){
is exists $p->{override}, 1, "$id ret override key exists";
is $p->{override}, 1, "$id ret override has correct updated value";
is $aux->{override}, 1, "$id get_aux override has correct updated value";
}
else { # light aux
is exists $p->{override}, 1, "and override key exists";
is $p->{override}, -1, "and override is disabled correctly";
is $aux->{override}, 0, "$id get_aux override has not been updated";
}
}
}
sub aux {
my $id = shift;
my $res = $test->request(GET "/get_aux/$id");
my $perl = decode_json $res->content;
return {
( run in 0.436 second using v1.01-cache-2.11-cpan-05444aca049 )