Ankündigung

Einklappen
Keine Ankündigung bisher.

LinKNX: Tipps, Tricks und Beispiele

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    #31
    Hoi Reto

    Hab' gerade meine kinknx.xml nicht dabei aber versuch's mal so:
    Code:
    <rule id="Alarm1">
      <condition type="or">
        <condition type="object" id="BW-Garage" value="1" trigger="true" />
        <condition type="object" id="Entre"     value="1" trigger="true" />
        <condition type="object" id="Keller"    value="1" trigger="true" />
      </condition>
      <actionlist type="if-true">
        <action type="set-value" id="Alarm"     value="1" />
      </actionlist>
    </rule>
    <rule id="Alarm2">
      <condition type="and">
        <condition type="object" id="Alarm"              value="1" trigger="true" />
        <condition type="object" id="Taster-Alarm-activ" value="1" trigger="true" />
      </condition>
      <actionlist type="if-true">
        <action type="set-value" id="Licht-Elter-on"     value="1" />
      </actionlist>
    </rule>
    Grüsse Bodo
    Fragen gehören ins Forum, und nicht in mein Postfach;
    EibPC-Fan; Wiregate-Fan; Timberwolf-Fan mit 30x 1-Wire Sensoren;

    Kommentar


      #32
      Salute Bodo


      Besten Dank, eilt gar nicht. Ich werde es versuchen am Wochenende zu testen, wenn es klappt kann meine Frau dann evtl. auch wieder besser schlafen ;-)

       
      Gruss und a schöns Weekend
      Reto

      Kommentar


        #33
        Hoi Reto

        Ich hab's für mich so gelöst.

        Code:
        <?xml version="1.0" ?>
        <config>
        
        ...
        
        <rules>
        <rule id="alarm-detect"> 
              <condition type="and"> 
                <condition type="object" id="A-P" value="off" trigger="true" />
                <condition type="object" id="anwesend_gruen" value="off" trigger="true" /> 
              </condition> 
              <actionlist> 
                <action type="set-value" id="warnleds" value="1" />
                <action type="cycle-on-off" id="l_entree_spots"    on="2" off="2" count="10" /> 
                <action type="cycle-on-off" id="l_kueche_spots"    on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_kueche_anrichte" on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_zimmer1"         on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_schlafzi"        on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_wohzi_esstisch"  on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_wohzi_sofa"      on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_schlafzi2er"     on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_schlafzi3er"     on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_zimmer2"         on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_sitzp_spots"     on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_bad_spiegel"     on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_bad"             on="2" off="2" count="10" />
                <action type="cycle-on-off" id="l_entree_spots"    on="2" off="2" count="10" />
                <action type="send-sms" id="BLUBBLUBBLUB" value="Alarm es wird eingebrochen." />  
                <action type="shell-cmd" cmd="/etc/ow/prowl.pl -apikey=BLABLABLABLABLABLA -event=KNX -notification=Alarm_es_wird_eingebrochen." />
                <action type="set-value" id="warnleds" value="0" delay="30" />
              </actionlist>
            </rule>
          </rules>
          <services>
            ...
            <smsgateway type="clickatell" user="gun" pass="blablabla" api_id="blubbblubb" />
            ...
          </services>
        </config>
        /etc/ow/prowl.pl

        Code:
        #!/usr/bin/perl -w
        # ProwlScript, to communicate with the Prowl server.
        #
        # Copyright (c) 2009, Zachary West
        # All rights reserved.
        # 
        # Redistribution and use in source and binary forms, with or without
        # modification, are permitted provided that the following conditions are met:
        #     * Redistributions of source code must retain the above copyright
        #       notice, this list of conditions and the following disclaimer.
        #     * Redistributions in binary form must reproduce the above copyright
        #       notice, this list of conditions and the following disclaimer in the
        #       documentation and/or other materials provided with the distribution.
        #     * Neither the name of Zachary West nor the
        #       names of its contributors may be used to endorse or promote products
        #       derived from this software without specific prior written permission.
        # 
        # THIS SOFTWARE IS PROVIDED BY Zachary West ''AS IS'' AND ANY
        # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
        # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        # DISCLAIMED. IN NO EVENT SHALL Zachary West BE LIABLE FOR ANY
        # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
        # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
        # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
        # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        #
        # This requires running Prowl on your device.
        # See the Prowl website <http://prowl.weks.net>
        # http://blog.fupps.com/2009/11/12/prowling-around-with-an-iphone/
        
        use strict;
        use LWP::UserAgent;
        use Getopt::Long;
        use Pod::Usage;
        
        # Grab our options.
        my %options = ();
        GetOptions(\%options, 'apikey=s', 'apikeyfile=s',
                              'application=s', 'event=s', 'notification=s',
                              'priority:i', 'help|?') or pod2usage(2);
        
        $options{'application'} ||= "ProwlScript";
        $options{'priority'} ||= 0;
        
        pod2usage(-verbose => 2) if (exists($options{'help'}));
        pod2usage(-message => "$0: Event name is required") if (!exists($options{'event'}));
        pod2usage(-message => "$0: Notification text is required") if (!exists($options{'notification'}));
        pod2usage(-priority => "$0: Priority must be in the range [-2, 2]") if ($options{'priority'} < -2 || $options{'priority'} > 2);
        
        # Get the API key from STDIN if one isn't provided via a file or from the command line.
        if (!exists($options{'apikey'}) && !exists($options{'apikeyfile'})) {
            print "API key: ";
        
            $options{'apikey'} = <STDIN>;
            chomp $options{'apikey'};
        } elsif (exists($options{'apikeyfile'})) {
            open(APIKEYFILE, $options{'apikeyfile'}) or die($!);
            $options{'apikey'} = <APIKEYFILE>;
            close(APIKEYFILE);
            
            chomp $options{'apikey'};
        }
        
        # URL encode our arguments
        $options{'application'} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
        $options{'event'} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
        $options{'notification'} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
        
        # Generate our HTTP request.
        my ($userAgent, $request, $response, $requestURL);
        $userAgent = LWP::UserAgent->new;
        $userAgent->agent("ProwlScript/1.0");
        
        $requestURL = sprintf("https://prowl.weks.net/publicapi/add?apikey=%s&application=%s&event=%s&description=%s&priority=%d",
                        $options{'apikey'},
                        $options{'application'},
                        $options{'event'},
                        $options{'notification'},
                        $options{'priority'});
        
        $request = HTTP::Request->new(GET => $requestURL);
        
        $response = $userAgent->request($request);
        
        if ($response->is_success) {
            print "Notification successfully posted.\n";
        } elsif ($response->code == 401) {
            print STDERR "Notification not posted: incorrect API key.\n";
        } else {
            print STDERR "Notification not posted: " . $response->content . "\n";
        }
        
        __END__
        
        =head1 NAME 
        
        prowl - Send Prowl notifications
        
        =head1 SYNOPSIS
        
        prowl.pl [options] event_information
        
         Options:
           -help              Display all help information.
           -apikey=...        Your Prowl API key.
           -apikeyfile=...    A file containing your Prowl API key.
        
         Event information:
           -application=...   The name of the application.
           -event=...         The name of the event.
           -notification=...  The text of the notification.
           -priority=...      The priority of the notification.
                              An integer in the range [-2, 2].
        
        =head1 OPTIONS
        
        =over 8
        
        =item B<-apikey>
        
        Your Prowl API key. It is not recommend you use this, use the apikeyfile option.
        
        =item B<-apikeyfile>
        
        A file containing one line, which has your Prowl API key on it.
        
        =item B<-application>
        
        The name of the Application part of the notification. If none is provided, ProwlScript is used.
        
        =item B<-event>
        
        The name of the Event part of the notification. This is generally the action which occurs, such as "disk partitioning completed."
        
        =item B<-notification>
        
        The text of the notification, which has more details for a particular event. This is generally the description of the action which occurs, such as "The disk /dev/abc was successfully partitioned."
        
        =item B<-notification>
        
        The priority level of the notification. An integer value ranging [-2, 2] with meanings Very Low, Moderate, Normal, High, Emergency.
        
        =back
        
        =head1 DESCRIPTION
        
        B<This program> sends a notification to the Prowl server, which is then forwarded to your device running the Prowl application.
        
        =head1 HELP
        
        For more assistance, visit the Prowl website at <http://prowl.weks.net>.
        
        =cut
        Grüsse Bodo
        Fragen gehören ins Forum, und nicht in mein Postfach;
        EibPC-Fan; Wiregate-Fan; Timberwolf-Fan mit 30x 1-Wire Sensoren;

        Kommentar


          #34
          Hoi Bodo


          Besten Dank für dein Beispiel. Ich gehe davon aus, dass die object id „A-P" alle Aktorenausgänge deiner Beleuchtung auf eine eigene Adresse im ETS4 verlink hast? Bei der Actionlist lässt du bei alarm-detect die lampen 10 mal blinken?


          Bin bei mir noch etwas am üben, vermutlich passt etwas noch nicht ganz mit meinem object type…..werde mal weiter üben.



          Gruss
          Reto

          Kommentar


            #35
            Hoi Reto

            A-P sind die Binäreingangskanäle mit Oder summiert, direkt im Gerät.

            Ja 10 mal blinken.
            Grüsse Bodo
            Fragen gehören ins Forum, und nicht in mein Postfach;
            EibPC-Fan; Wiregate-Fan; Timberwolf-Fan mit 30x 1-Wire Sensoren;

            Kommentar


              #36
              Hallo Bodo

              Cool, besten Dank für deine Hilfe. Ich habe die Alarmfunktion in Betrieb.
              Langsam aber sicher wächst meine xml Datei, es gibt noch so einiges zu implementieren ;-)
               
              a schöns Tägli
              Gruss
              Reto
               

              Kommentar


                #37

                Anbei die aktuelle AND OR Verknüpfung :

                Code:
                  <rule id="Alarm">
                  <condition type="and">
                    <condition type="object" id="Taster-Alarm-BM" value="1" trigger="true" />
                    <condition type="or">
                      <condition type="object" id="Licht-Garage" value="1" trigger="true" />
                      <condition type="object" id="Entree-Licht" value="1" trigger="true" />
                      <condition type="object" id="Bad-EG-Licht" value="1" trigger="true" />
                   <condition type="object" id="Wachkueche-Licht" value="1" trigger="true" />
                   <condition type="object" id="Geraeteraum-Licht" value="1" trigger="true" />
                   <condition type="object" id="Abstellraum-Licht" value="1" trigger="true" />
                   <condition type="object" id="Keller-Licht" value="1" trigger="true" />
                   <condition type="object" id="UG-Gang-Licht" value="1" trigger="true" />
                   <condition type="object" id="UG-Treppe" value="1" trigger="true" />
                   <condition type="object" id="Kueche-Licht" value="1" trigger="true" />
                   </condition>
                  </condition>
                  <actionlist type="if-true">
                   <action type="cycle-on-off" id="Eltern-Licht" on="2" off="2" count="5" />
                  </actionlist>
                </rule>
                Zuletzt geändert von fox007; 09.04.2015, 09:39.

                Kommentar


                  #38
                  Hallo zusammen,

                  ich hätte Fragen an die linknx-Experten hier.
                  Und zwar habe ich einen Reedschalter auf meinem Gaszähler, der mir mittels Binäreingang die Impulse aufsummiert und in eine GA schreibt.

                  Nun hätte ich gerne 4 weitere GAs erstellt, die 1) den aufsummierten Tagesverbrauch
                  2) den aufsummierten Vortagesverbrauch
                  3) den aufsummierten Monatsverbrauch
                  4) den aufsummierten Vormonatsverbrauch

                  enthalten. Ziel ist es, diese für einen schnellen Überblick in der visu anzuzeigen.

                  Lässt sich die Umkopier-Logik mit linknx realisieren?
                  Kann mir jemand Tipps geben oder habt ihr bessere Ideen?

                  Danke für eure Hilfe.
                  Gruß, Stefan

                  Kommentar

                  Lädt...
                  X