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

Ia7 v1.2.301 #599

Merged
merged 35 commits into from
Jul 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f43d1cf
Experimental: Backend components to allow for real-time IA7 notificat…
hplato Nov 3, 2015
8b2a48e
Merge branch 'ia7' of https://github.com/hplato/misterhouse into ia7
hplato Nov 3, 2015
fbd7517
Issue a socket shutdown command rather than a close. Fixes an issue with
hplato Nov 3, 2015
7ca8db7
Removed Data::Dumper debug reference
hplato Nov 3, 2015
f8ba035
IA7 v1.1 -- additional backend support for notifications
hplato Nov 5, 2015
49ddb4e
Updated notifications area in options modal, set up speech with sound…
hplato Nov 6, 2015
370e292
cleaning up jaascript file, fixed notification banner location
hplato Nov 15, 2015
f8d5644
Updated Javascript Notifications - Alert Window
hplato Nov 15, 2015
8d5e390
Fixed issue with RRD last updated
hplato Nov 16, 2015
68e9d06
User module to enable IA7 json speech
hplato Nov 16, 2015
2bbca10
Cleaned up json_server, added icons for notifications if viewing on a…
hplato Nov 16, 2015
8a40589
Added in notifications parameters in ia7_config.json
hplato Nov 16, 2015
e148d2d
HTML 5 Audio setup,
hplato Nov 29, 2015
b8522a2
WIP, added HTTP 1.1/206 support and have rough Safari Audio!
hplato Dec 4, 2015
8b70ce2
Audio working on major browsers, tested on Chrome, Firefox and Safari
hplato Dec 6, 2015
f23ed1e
Rudimentary audio support for ipad and android.
hplato Dec 6, 2015
3e85ea8
Cleaned up javascript, added option for showing audio controls, press…
hplato Dec 8, 2015
022e806
Perltidy custom files
hplato Feb 28, 2016
817a27c
Added back in changes to support https in the future
hplato Feb 28, 2016
10682bd
Added in Clive's json_server suggestion. Parse $Authorize and provide…
hplato Mar 1, 2016
bf0645c
IA7 v1.1.300
hplato Mar 4, 2016
853a5a5
IA7 v1.2.100 - basic support for SET_PASSWORD and UNSET_PASSWORD in j…
hplato Mar 13, 2016
f898302
common and user code, opening code links now shows in a pretty IA7 co…
hplato Mar 15, 2016
50bf382
IA7 v1.2.200 - Ability for legacy perl forms to return data into a mo…
hplato Mar 15, 2016
49ef4af
ia7 prefs table
hplato Mar 18, 2016
84ca50a
IA7 v1.2.300 - Updated 'About Mr.House to include the ability to show…
hplato Mar 20, 2016
cf3fd16
Updates to get all the 'Setup Mr.House' code files to work properly
hplato Mar 28, 2016
952ac77
IA7 v1.2.301 - Major functionality in place for setup mr.house forms.…
hplato Apr 19, 2016
2ba3103
Removed some debug statements
hplato May 28, 2016
9cdd920
Updated ia7_collections_upgrader to add item 700 to the gear modal (i…
hplato May 28, 2016
2a70f7b
Make ia7 floorplan setup interactive
May 29, 2016
46de086
do not access ia7_config.state_colors if it was not defined in user c…
May 29, 2016
db146cc
Merge pull request #2 from tobser/ia7-1.2_floorplan_merge
hplato May 30, 2016
fba93ef
IA7 v1.2.350
hplato Jul 4, 2016
3900acd
Added in a version to collections.json to make upgrading in the futur…
hplato Jul 4, 2016
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
51 changes: 51 additions & 0 deletions code/common/ia7_collection_upgrader.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Category = IA7

#@ IA7 v1.2 : This is a helper utility that can find and update collections.json files
#@ if any structural changes are required.
#@
#@ v1.2 - add in new login system id 700

my $ia7_coll_current_ver = 1.2;

if ($Startup) {

my @collection_files = ("$Pgm_Root/data/web/collections.json",
"$config_parms{data_dir}/web/collections.json",
"$config_parms{ia7_data_dir}/collections.json");
for my $file (@collection_files) {
if (-e $file) {
print_log "[IA7_Collection_Updater] : Checking $file to current version $ia7_coll_current_ver";
my $json_data;
my $file_data;
eval {
$file_data = file_read($file);
$json_data = decode_json($file_data); #HP, wrap this in eval to prevent MH crashes
};

if ($@) {
print_log "[IA7_Collection_Updater] : WARNING: decode_json failed for $file. Please check this file!";
} else {
my $updated = 0;

if ((! defined $json_data->{meta}->{version}) or ($json_data->{meta}->{version} < 1.2)) { #IA7 v1.2 required change
$json_data->{700}->{user} = '$Authorized' unless (defined $json_data->{700}->{user});
my $found = 0;
foreach my $i (@{$json_data->{500}->{children}}) {
$found = 1 if ($i == 700);
}
push (@{$json_data->{500}->{children}},700) unless ($found);
$json_data->{meta}->{version} = "1.2";
print_log "[IA7_Collection_Updater] : Checking $file to version $ia7_coll_current_ver";
$updated = 1;
}
if ($updated) {
my $json_newdata = to_json($json_data, {utf8 => 1, pretty => 1});
my $backup_file = $file . ".v" . $version . ".backup";
file_write($backup_file,$file_data);
print_log "[IA7_Collection_Updater] : Saved backup " . $file . ".v" . $version . ".backup";
file_write($file,$json_newdata);
}
}
}
}
}
45 changes: 45 additions & 0 deletions code/common/ia7_notifications.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Category = IA7

#@ IA7 v1.1 : Enables speech notifications to browsers.
#@ also includes some sample code of how to use other notifications

if ($Startup or $Reload) {
if (! defined $Info{IPAddress_local}) {
print_log "json_server.pl: \$Info{IPAddress_local} not defined. Json speech disabled";
} else {
print_log "IA7 Speech Notifications enabled";
&Speak_parms_add_hook(\&json_speech_enable);
}
}

$v_ia7_test_sound = new Voice_Cmd ("Test playing a sound");
$v_ia7_test_banner = new Voice_Cmd("Test [blue,green,yellow,red] Banner Notification");

if (my $said = said $v_ia7_test_banner) {
my %data;
$data{text} = "This is a test of the IA7 notification";
$data{color} = $said;
&json_notification("banner",{%data});
}

if (said $v_ia7_test_sound) {
my %data;
$data{url} = "http://" . $Info{IPAddress_local} . ":" . $config_parms{http_port} . "/misc/tellme_welcome.wav";
&json_notification("sound",{%data});
}

sub json_speech_enable {
my ($parms) = @_;
push @{$parms->{web_hook}},\&file_ready_for_ia7;
}

sub file_ready_for_ia7 {
my (%parms) = @_;
my %data;
$data{mode} = $parms{mode};
$data{url} = "http://" . $Info{IPAddress_local} . ":" . $config_parms{http_port} . "/" . $parms{web_file};
$data{text} = $parms{raw_text};
$data{client} = $parms{requestor};
&json_notification("speech",{%data});
}

13 changes: 7 additions & 6 deletions data/web/collections.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
"28" : {
"link" : "/bin/set_parm_tv_provider.pl",
"name" : "Setup TV Provider",
"mode" : "advanced",
"icon" : "fa-desktop"
},
"5" : {
Expand Down Expand Up @@ -487,6 +488,7 @@
"26" : {
"link" : "/ia5/house/irman.shtml",
"name" : "Program IRMAN",
"mode" : "advanced",
"icon" : "fa-rss"
},
"57" : {
Expand Down Expand Up @@ -707,6 +709,7 @@
"27" : {
"icon" : "fa-wrench",
"name" : "Header Control",
"mode" : "advanced",
"link" : "/bin/headercontrol.pl"
},
"78" : {
Expand All @@ -717,7 +720,7 @@
"102" : {
"name" : "Picture Frame",
"icon" : "fa-desktop",
"external" : "http://home.krkeegan.com:8081/misc/photos.shtml"
"external" : "$config_parms{html_dir}/misc/photos.shtml"
},
"105" : {
"link" : "/ia5/calendar/main.shtml",
Expand Down Expand Up @@ -772,14 +775,12 @@
"icon" : "fa-home",
"name" : "Gear Settings",
"children" : [
501
700

]
},
"501" : {
"link" : "/UNSET_PASSWORD?user=admin",
"name" : "Authorize",
"icon" : "fa-lock"
"700" : {
"user" : "$Authorized"
},
"600" : {
"link" : "/ia7/#path=/objects&parents=ia7_status_items",
Expand Down
4 changes: 3 additions & 1 deletion data/web/ia7_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"fp_icon_size" : "32",
"fp_state_popovers" : "yes",
"substate_percentages" : "20",
"disable_current_state" : "yes"
"disable_current_state" : "yes",
"notifications" : "yes",
"speech_default" : "banner"
},
"objects" : {
"example_object" : {
Expand Down
5 changes: 4 additions & 1 deletion lib/ajax.pm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ sub checkForUpdate {
&main::print_log("checkForUpdate sub ${$$self{sub}} returned $xml")
if $main::Debug{ajax};
&::print_socket_fork( ${ $$self{waitingSocket} }, $xml );
${ $$self{waitingSocket} }->close;
&main::print_log( "Closing Socket " . ${ $$self{waitingSocket} } )
if $main::Debug{ajax};
${ $$self{waitingSocket} }->shutdown(2)
; #Changed this from close() to shutdown(2). In some cases, the parent port wasn't being closed -- ie. speech events
${ $$self{changed} } = 1;
}
else {
Expand Down
Loading