Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed nanolead poll queue, updated MH5 whatsnew page #739

Merged
merged 1 commit into from
Oct 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 8 additions & 35 deletions lib/Nanoleaf_Aurora.pm
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package Nanoleaf_Aurora;

#todo if poll queue exceeds 3, then just empty the queue
#print and purge the command queue

# v1.0.14
# v1.0.15

#if any effect is changed, by definition the static child should be set to off.
#cmd data returns, need to check by command
Expand Down Expand Up @@ -34,10 +31,9 @@ use IO::Socket::INET;
# the location URL and tokens are stored in the mh.ini file

# Firmware supported
# 1.4.38 or earlier - no
# 1.5.0 to 2.1.3 - yes
# 1.4.39 - pass the option api=beta
# 1.5.0 - yes
# 1.5.1 - yes
# 1.4.38 or earlier - no

# Nanoleaf_Aurora Objects
#
Expand Down Expand Up @@ -125,7 +121,7 @@ sub new {
$self->{updating} = 0;
$self->{data}->{retry} = 0;
$self->{status} = "";
$self->{module_version} = "v1.0.14";
$self->{module_version} = "v1.0.15";
$self->{ssdp_timeout} = 4000;
$self->{last_static} = "";

Expand Down Expand Up @@ -257,7 +253,8 @@ sub process_check {

if ( $self->{poll_process}->done_now() ) {

shift @{ $self->{poll_queue} }; #remove the poll since they are expendable.
#shift @{ $self->{poll_queue} }; #remove the poll since they are expendable.
@{ $self->{poll_queue} } = (); #clear the queue since process is done.

my $com_status = "online";
main::print_log( "[Aurora:" . $self->{name} . "] Background poll " . $self->{poll_process_mode} . " process completed" ) if ( $self->{debug} );
Expand Down Expand Up @@ -338,18 +335,6 @@ sub process_check {
}
}

#polls are expendable and will always trigger on the timer, so don't keep a queue
# if ( scalar @{ $self->{poll_queue} } ) {
# my $cmd_string = shift @{ $self->{poll_queue} };
# my ( $mode, $cmd ) = split /\|/, $cmd_string;
# $self->{poll_process}->set($cmd);
# $self->{poll_process}->start();
# $self->{poll_process_pid}->{ $self->{poll_process}->pid() } = $mode; #capture the type of information requested in order to parse;
# $self->{poll_process_mode} = $mode;
# main::print_log( "[Aurora:" . $self->{name} . "] Poll Queue " . $self->{poll_process}->pid() . " mode=$mode cmd=$cmd" )
# if ( $self->{debug} );
#
# }
if ( defined $self->{child_object}->{comm} ) {
if ( $self->{status} ne $com_status ) {
main::print_log "[Aurora:"
Expand Down Expand Up @@ -488,20 +473,8 @@ sub _get_JSON_data {
push @{ $self->{poll_queue} }, "$mode|$cmd";
}
else {
main::print_log( "[Aurora:" . $self->{name} . "] WARNING. Queue has grown past " . $self->{max_poll_queue} . ". Clearing Polling Queue." );
@{ $self->{poll_queue} } = (); #Polls are disposable
if ( defined $self->{child_object}->{comm} ) {
if ( $self->{status} ne "offline" ) {
main::print_log "[Aurora:"
. $self->{name}
. "] Communication Tracking object found. Updating from "
. $self->{child_object}->{comm}->state()
. " to offline..."
if ( $self->{loglevel} );
$self->{status} = "offline";
$self->{child_object}->{comm}->set( "offline", 'poll' );
}
}
#the queue has grown past the max, so it might be down. Since polls are expendable, just don't do anything
#when the aurora is back it will process the backlog, and as soon as a poll is processed, the queue is cleared.
}
}
}
Expand Down
78 changes: 69 additions & 9 deletions web/ia7/house/whatsnew.shtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<h1>Misterhouse Version 5.0 - Release date:</h1><br>
<h1 style="text-align:left;float:left;margin-top:10px">v5.0</h1>
<h3 style="text-align:right;float:right;margin-right:15px;">Released 2017/10/31</h3>
<hr style="clear:both;margin-right:15px"/>

<div class="panel-group whatsnew-panel">
<div class="panel panel-default">
Expand All @@ -8,8 +10,18 @@
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">Panel Body</div>
<div class="panel-footer">Panel Footer</div>
<div class="panel-body">
<ul class="fa-ul">
<li><i class="fa-li fa fa-chevron-right"></i>Enable any of the supported common code modules:
<ul>
<li>internet_weather.pl
<li>internet_weather_noaa.pl
<li>weather_metar.pl
<li>weather_wunderground.pl
</ul>
<li><i class="fa-li fa fa-chevron-right"></i>Make sure the ia7_pref "show_weather" is not set to "no"
</ul>
</div>
</div>
</div>

Expand Down Expand Up @@ -48,21 +60,69 @@
</h4>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">Panel Body</div>
<div class="panel-footer">Panel Footer</div>
<div class="panel-body">

<ul class="fa-ul">
<li><i class="fa-li fa fa-chevron-right"></i>To have a floorplan mapped to a group, there needs to be a base image, and a MH group of items. For this example, we'll use the MH group floor1
<li><i class="fa-li fa fa-chevron-right"></i>The IA7 path for floor1 will be:/ia7/#path=/floorplan?floor1
<li><i class="fa-li fa fa-chevron-right"></i>by default, the floorplans are stored with the rest of the graphics in /ia7/graphics.
<li><i class="fa-li fa fa-chevron-right"></i>there is a config.json item: "floorplan_baseimg_dir" : "/ia7_floorplans",
<li><i class="fa-li fa fa-chevron-right"></i>you can set up a custom directory and then this setting will override /ia7/graphics.
<li><i class="fa-li fa fa-chevron-right"></i>in the graphics directory there should be a floorplan-GROUP.png file that is the base image to put the group objects on. for the example it would be floorplan-floor1.png
<li><i class="fa-li fa fa-chevron-right"></i>Adding Floorplan Cameras to usercode (Zoneminder example)
<li><i class="fa-li fa fa-chevron-right"></i>$cam = new FPCamera_Item;
<li><i class="fa-li fa fa-chevron-right"></i>$cam -> set_img("http://ZMIP/cgi-bin/nph-zms?mode=jpeg&monitor=5&scale=100&maxfps=30");
<li><i class="fa-li fa fa-chevron-right"></i>$cam -> set_link("http://ZMIP/zm/?view=watch&mid=5");
<li><i class="fa-li fa fa-chevron-right"></i>$cam -> set_label("Camera1 ");
<li><i class="fa-li fa fa-chevron-right"></i>$floor1 -> add($cam);
<li><i class="fa-li fa fa-chevron-right"></i>Clicking the developer icon will allow the icons to be dragged and dropped around the floorplan. The usercode needed for this layout will be below the image. You will have to create a usercode file with this perl code.
<li><i class="fa-li fa fa-chevron-right"></i>Icon sets are defined in usercode $object->set_fp_icon_set("blinds");
<li><i class="fa-li fa fa-chevron-right"></i>Location is set in usercode $object->set_fp_location(29.97250229147571,91.71122994652407);
<li><i class="fa-li fa fa-chevron-right"></i>To set multiple icons for the same object, specify additional locations $object->set_fp_location(10,20,30,40,50,60);
</ul>

</div>
</div>
</div>


<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse3">Add dynamic RRD graphs</a>
<a data-toggle="collapse" href="#collapse4">Add dynamic RRD graphs</a>
</h4>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">Panel Body</div>
<div class="panel-footer">Panel Footer</div>
<div id="collapse4" class="panel-collapse collapse">
<div class="panel-body">

<ul class="fa-ul">
<li><i class="fa-li fa fa-chevron-right"></i>The link format is /ia7/#path=/rrd?TIME?SOURCE
<li><i class="fa-li fa fa-chevron-right"></i>SOURCE can either be the built in weather or an external RRD
<li><i class="fa-li fa fa-chevron-right"></i>ie /ia7/#path=/rrd?now-6hour?outdoor_temp will graph the internal outdoor_temp group
<li><i class="fa-li fa fa-chevron-right"></i> /ia7/#path=/rrd?now-6hour?ext.temps will graph the external temps group from source ext
<li><i class="fa-li fa fa-chevron-right"></i>The external source also needs a config_parm: $config_parms{"rrd_source_" .$rrd_source . "_path"}
<li><i class="fa-li fa fa-chevron-right"></i>The groups are defined in the ia7_rrd_config.json file, in the ds section;
<ul>
<li>"temp" : {
<li> "type" : "temperature",
<li> "label" : "Outside Temperature",
<li> "color" : "#330099",
<li> "round" : "1",
<li> "group" : "outdoor_temp,temp"
<li> },
</ul>
<li><i class="fa-li fa fa-chevron-right"></i>A DS can be in multiple groups.
<li><i class="fa-li fa fa-chevron-right"></i>Times are also stored in the ia7_rrd_config.json file in the periods section, with the label, and the rrdtool time value in the value
<ul>
<li> "periods" : {
<li> "1" : "6 hours,now-6hour",
<li> "2" : "12 hours,now-12hour",
<li> "3" : "1 day,now-1day",
<li> "4" : "2 days,now-2day",
</ul>
</ul>

</div>
</div>
</div>

Expand Down