Ich habe seit ein paar Monaten auf meinem Android HTC M7 und Win8.1-PC Pushbullet laufen.
Für das WG habe ich ein Plugin erstellt das Pushbullet Nachrichten ans Handy und PC sendet.
pushbullet.config
Plugin pushbullet.pl
Viel Spaß
Gruß NetFritz
Für das WG habe ich ein Plugin erstellt das Pushbullet Nachrichten ans Handy und PC sendet.
pushbullet.config
Code:
# pushbullet.pl - Konfiguration # # GA=>'1/4/20', = GA die getriggert wird # type=>'note' # title=>'' # body_on=>'' = Text wenn GA auf 1 # body_off=>'' = Text wenn GA auf 0 %push=( push =>{GA=>'1/3/74',type=>'note',title=>'WP',body_on=>'AUS',body_off=>'EIN'}, push =>{GA=>'0/1/666',type=>'note',title=>'Ping Wetterstation',body_on=>'AUS',body_off=>'EIN'}, );
Code:
# Pushbullet Sender für WG # In conf GA, title und body eintragen # wenn GA=1 dann werden title und body gesendet # by NetFritz KNX-Userforum # Konfigurationsfile einlesen my $conf=$plugname; $conf=~s/\.pl$/.conf/; $conf="/etc/wiregate/plugin/generic/conf.d/$conf"; my %push=(); my $err=read_from_config(); return $err if $err; # # in $iso steht Datum-Zeit = 'd.m.Y H:M' my @dta = localtime(time); my $iso=sprintf('%02d.',$dta[3]); $iso.=sprintf('%02d.',$dta[4]+1); $iso.=($dta[5]+1900)." "; $iso.=sprintf('%02d:',$dta[2]); $iso.=sprintf('%02d',$dta[1]); # $plugin_info{$plugname.'_cycle'} = 3600; # Alle GAs aus der config abonnieren for my $r (grep ref($push{$_}), keys %push) { $plugin_subscribe{$push{$r}{GA}}{$plugname}=1; } my $req = ""; my $body = ""; # BUS ueberwachen if ($msg{'apci'} eq "A_GroupValue_Write") { # A_GroupValue_Write Telegramm eingetroffen for my $r (grep ref($push{$_}), keys %push){ # Ueberwachte GAs durchlaufen if ($msg{'dst'} eq $push{$r}{GA}){ # GAs vergleichen if($msg{'value'} == 1 && $plugin_info{$plugname.'_'.$r.'_alt'} == 0 ){ $body = $push{$r}{body_on}; $plugin_info{$plugname.'_'.$r.'_alt'} = 1; }elsif($msg{'value'} == 0){ $body = $push{$r}{body_off}; $plugin_info{$plugname.'_'.$r.'_alt'} = 0; } # Push senden use LWP::UserAgent; use HTTP::Request::Common qw(POST); my $ua = LWP::UserAgent->new; my $req = POST 'https://api.pushbullet.com/v2/pushes', [ type => 'note', title => $push{$r}{title}, body => $iso." ". $body ]; $req->authorization_basic('wird von pushbullet vergeben'); #return ($push{$r}{GA}); print ($ua->request($req)->as_string); plugin_log($plugname, "$push{$r}{title} $push{$r}{body} $msg{'value'}"); } } } return; # ------------- config einlesen ---------------------- sub read_from_config { open CONFIG, "<$conf" || return "no config found"; my @lines = <CONFIG>; close CONFIG; eval("@lines"); return "config error" if $@; }
Gruß NetFritz
Kommentar