Connair über FHEM steuern

Begonnen von rippi46, 06 November 2013, 20:04:17

Vorheriges Thema - Nächstes Thema

ms81

#15
Das geht einwandfrei!

Vielen Dank rippi46!

Wie könnte ich den "Stop" Befehl noch integrieren? Weil so kann ich die Rollläden nur komplett hoch und runterfahren.

EDIT:
Habe es selbst hinbekommen:

In 99_MyUtils.pm sieht es nun so aus:
sub connair_R_WZ {

   
my ($state) = "$_[0]";
if ($state eq "auf")
{
  system("echo \"TXP:0,0,10,10920,91,42,57,18,8,4,4,8,8,4,4,8,4,8,4,8,4,8,8,4,8,4,4,8,8,4,8,4,8,4,4,8,8,4,4,8,4,8,8,4,4,8,8,4,8,4,8,4,4,8,8,4,8,4,4,8,8,4,8,4,4,8,8,4,8,4,8,4,4,8,4,8,4,8,8,4,4,8,4,8,4,8,8,120,0;\" | nc -u 192.168.178.20 49880 & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}
if ($state eq "ab")
{
  system("echo \"TXP:0,0,10,10920,91,42,57,18,8,4,4,8,8,4,4,8,4,8,4,8,4,8,8,4,8,4,4,8,8,4,8,4,8,4,4,8,8,4,4,8,4,8,8,4,4,8,8,4,8,4,8,4,4,8,8,4,8,4,4,8,8,4,8,4,4,8,8,4,8,4,8,4,4,8,4,8,8,4,8,4,4,8,4,8,8,4,8,120,0;\" | nc -u 192.168.178.20 49880 & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}

if ($state eq "stop")
{
  system("echo \"TXP:0,0,10,10920,91,42,57,18,8,4,4,8,8,4,4,8,4,8,4,8,4,8,8,4,8,4,4,8,8,4,8,4,8,4,4,8,8,4,4,8,4,8,8,4,4,8,8,4,8,4,8,4,4,8,8,4,8,4,4,8,8,4,8,4,4,8,8,4,8,4,8,4,4,8,8,4,4,8,8,4,4,8,8,4,4,8,8,120,0;\" | nc -u 192.168.178.20 49880 & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}

}


Und in der fhem.cfg:
#Rolladen Wohnzimmer
define Roll_WZ dummy
attr Roll_WZ alias Rollladen Wohnzimmer
attr Roll_WZ eventMap BI:auf B0:ab BS:stop
attr Roll_WZ room Gartenstr_2
attr Roll_WZ webCmd auf:ab:stop
define Roll_WZ_ntfy notify Roll_WZ:.* {\
    my $v=Value("Roll_WZ");;\
    if ($v eq "auf") {connair_R_WZ("auf")};;\
    if ($v eq "ab") {connair_R_WZ("ab")};;\
    if ($v eq "stop") {connair_R_WZ("stop")};;\
    }


Vielen Dank nochmals!

rippi46

Hallo ms81

das hier in die fhem.cfg


define RolladenW dummy
attr RolladenW alias Rolladen Wohnzimmer
attr RolladenW eventMap on:auf off:ab stop:stop
attr RolladenW room Wohnzimmer
attr RolladenW setList state:auf,ab,stop
define RolladenW_ntfy notify RolladenW:.* {\
    my $v=Value("RolladenW");;\
    if ($v eq "auf") {connair("auf")};;\
    if ($v eq "ab") {connair("ab")};;\
    if ($v eq "ab") {connair("stop")};;\
    }



und das in die 99_myUtils.pm


use CGI qw(:standard);
use IO::Socket;
use MIME::Base64;
use Time::Piece;
$main::NextUpdate = ();

sub connair {

   
my ($state) = "$_[0]";
if ($state eq "auf")
{
  system("echo \" Befehl für auf  \" | nc -u 192.168.178.20 49880 & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}
else
{
    if ($state eq "stop")
    {
     system("echo \" Befehl für stop \" | nc -u 192.168.178.20 49880 & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
    }
    else
    {
    system("echo \" Befehl für ab \" | nc -u 192.168.178.20 49880 & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
    }
}
}




So würde ich es versuchen.

Gruß rippi46
FHEM, LMS, VDR ,Dell 9010 Ubuntu 20.04,Raspimatic, HM/HMIP, Max, Elro, Brennenstuhl u. Intertechno mit Connair.
Picoreplayer, Raspi IR-Lanadapter, Firmata(wifi), LaCrosse,
nanocul433, nanocul868, Signalduino, Connexoon,
MySensor-GW+Sensoren, RGBWW, Zigbee2mqtt,Xiaomi,Nextion,LEDMatrix,Alexa

ms81

#17
Danke

Hab es eben selbst hinbekommen.

Habe den Beitrag oben editiert. Ist etwas anders und ich weiß nicht ob man das auch so korrekt ist, aber es funktioniert jedenfalls.


CarstenF

Hallo zusammen, ich hoffe der Beitrag ist noch nicht zu alt und es liest noch jemand mit,

Ich habe fast die gleiche Config wie rippi46, bzw. die gleichen Geräte. Habe nun versucht meine erste Elro Steckdose in FHEM einzubinden. Klappt aber nicht. Meine Connair macht leider keinen Mucks (nur über die Stecker Checker App, bzw. über meine L3X Mobile Webapp). Ich würde aber gerne beide Systeme in FHEM "überführen".
Ich hab im Moment keine Idee wie ich weiterkomme (und ich hab schon viel gelesen...).
FHEM zeigt mir das neue Gerät an, jedoch geht kein Signal an die Connair. Die IP wurde entsprechend geändert. Habt ihr noch ne Idee dazu?

Gruß Carsten
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

scooty

Hallo Carsten,

erst einmal die einfachen Sachen:

- Reload der 99_myUtils.pm (oder Neustart von fhem) durchgeführt?
- Gibt es Fehlermeldungen im fhem-Log?
- $master/$slave Angaben im DEF des fhem-Devices richtig?

Andreas
Fhem auf Gigabyte Brix
CUL V3 HM / CUL V3 MAX / MaxCube aFW Homematic&MAX / ZWave.me ZME_UZB1 / SDuino 433 / Velux KLF200
Homematic / MAX / Logitech Hub / ZWave / Wifi LED / div. 433 Temperatursensoren / pywws WH10880 / IO Homecontrol

CarstenF

Hi,
Mist, jetzt hab ich mir glaube ich erstmal das Image geschrottet. FHEM startet nicht mehr. Muß jetzt leider zur Arbeit. Jedoch hatte ich als Fehler vorher die "requires explicit package" Meldung. Die hatte ich dann mit dem ausklammern von strict wegbekommen.
Ich würde da aber nochmal ein Logfile nachschieben, wenns wieder läuft.
Tja und die Master Slave Geschichte hab ich mehrfach geprüft. Ich glaube die Angaben sind richtig.
Wie gesagt, ich melde mich
Danke trotzdem schonmal
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

CarstenF

So, da ist er wieder...

Ich hab's wieder am laufen. Also meine Max Heizungssteuerung wird problemlos eingebunden.
Nur die Connair zickt rum, bzw. wird nicht angesprochen.

Fehlermeldung beim Abspeichern von 99_myUtils.pm


Undefined subroutine &main::myUtils_Initialize called at fhem.pl line 1777.

Das ist die Datei, bzw. der Inhalt:
Ich hoffe es ist ok, wenn man das hier so postet.


##############################################
# $Id: 99_Utils.pm 3595 2013-08-05 05:38:48Z tobiasfaust $
package main;

#use strict;
use warnings;
use POSIX;


sub
Utils_Initialize($$)
{
  my ($hash) = @_;
}

sub
time_str2num($)
{
  my ($str) = @_;
  my @a;
  if($str ne "") {
    @a = split("[- :]", $str);
    return mktime($a[5],$a[4],$a[3],$a[2],$a[1]-1,$a[0]-1900,0,0,-1);
  } else {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
    return mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, -1);
  }
}

sub
min($@)
{
  my ($min, @vars) = @_;
  for (@vars) {
    $min = $_ if $_ lt $min;
  }           
  return $min;
}

sub
max($@)
{
  my ($max, @vars) = @_;
  for (@vars) {
    $max = $_ if $_ gt $max;
  }           
  return $max;
}

sub
minNum($@)
{             
  my ($min, @vars) = @_;
  for (@vars) {
    $min = $_ if $_ < $min;
  }           
  return $min;
}

sub
maxNum($@)
{             
  my ($max, @vars) = @_;
  for (@vars) {
    $max = $_ if $_ > $max;
  }           
  return $max;
}


sub
abstime2rel($)
{
  my ($h,$m,$s) = split(":", shift);
  $m = 0 if(!$m);
  $s = 0 if(!$s);
  my $t1 = 3600*$h+60*$m+$s;

  my @now = localtime;
  my $t2 = 3600*$now[2]+60*$now[1]+$now[0];
  my $diff = $t1-$t2;
  $diff += 86400 if($diff <= 0);

  return sprintf("%02d:%02d:%02d", $diff/3600, ($diff/60)%60, $diff%60);
}

use CGI qw(:standard);
use IO::Socket;
use MIME::Base64;
use Time::Piece;
$main::NextUpdate = ();

sub connair {
my $c_ip = "192.168.1.55";
my $c_port = "49880";
my $c_speed = "16";
my $c_A = "0";
my $c_G = "0";
my $c_repeat = "15";
my $c_pause = "5600";
my $c_tune = "350";
my $c_baud = "25";
my $c_speed = "16";
my $c_AN = "1,3,1,3,3";
my $c_AUS = "3,1,1,3,1";
my $c_master = "$_[1]";
my $c_slave = "$_[2]";
my $c_bitLow="1";
my $c_bitHgh="3";

my $c_seqLow="$c_bitHgh,$c_bitHgh,$c_bitLow,$c_bitLow,";
my $c_seqHgh="$c_bitHgh,$c_bitLow,$c_bitHgh,$c_bitLow,";


$c_bits[0]="$c_seqLow$c_seqLow$c_seqLow$c_seqLow$c_seqLow";
$c_bits[1]="$c_seqLow$c_seqLow$c_seqLow$c_seqLow$c_seqHgh";
$c_bits[2]="$c_seqLow$c_seqLow$c_seqLow$c_seqHgh$c_seqLow";
$c_bits[3]="$c_seqLow$c_seqLow$c_seqLow$c_seqHgh$c_seqHgh";
$c_bits[4]="$c_seqLow$c_seqLow$c_seqHgh$c_seqLow$c_seqLow";
$c_bits[5]="$c_seqLow$c_seqLow$c_seqHgh$c_seqLow$c_seqHgh";
$c_bits[6]="$c_seqLow$c_seqLow$c_seqHgh$c_seqHgh$c_seqLow";
$c_bits[7]="$c_seqLow$c_seqLow$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[8]="$c_seqLow$c_seqHgh$c_seqLow$c_seqLow$c_seqLow";
$c_bits[9]="$c_seqLow$c_seqHgh$c_seqLow$c_seqLow$c_seqHgh";
$c_bits[10]="$c_seqLow$c_seqHgh$c_seqLow$c_seqHgh$c_seqLow";
$c_bits[11]="$c_seqLow$c_seqHgh$c_seqLow$c_seqHgh$c_seqHgh";
$c_bits[12]="$c_seqLow$c_seqHgh$c_seqHgh$c_seqLow$c_seqLow";
$c_bits[13]="$c_seqLow$c_seqHgh$c_seqHgh$c_seqLow$c_seqHgh";
$c_bits[14]="$c_seqLow$c_seqHgh$c_seqHgh$c_seqHgh$c_seqLow";
$c_bits[15]="$c_seqLow$c_seqHgh$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[16]="$c_seqHgh$c_seqLow$c_seqLow$c_seqLow$c_seqLow";
$c_bits[17]="$c_seqHgh$c_seqLow$c_seqLow$c_seqLow$c_seqHgh";
$c_bits[18]="$c_seqHgh$c_seqLow$c_seqLow$c_seqHgh$c_seqLow";
$c_bits[19]="$c_seqHgh$c_seqLow$c_seqLow$c_seqHgh$c_seqHgh";
$c_bits[20]="$c_seqHgh$c_seqLow$c_seqHgh$c_seqLow$c_seqLow";
$c_bits[21]="$c_seqHgh$c_seqLow$c_seqHgh$c_seqLow$c_seqHgh";
$c_bits[22]="$c_seqHgh$c_seqLow$c_seqHgh$c_seqHgh$c_seqLow";
$c_bits[23]="$c_seqHgh$c_seqLow$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[24]="$c_seqHgh$c_seqHgh$c_seqLow$c_seqLow$c_seqLow";
$c_bits[25]="$c_seqHgh$c_seqHgh$c_seqLow$c_seqLow$c_seqHgh";
$c_bits[26]="$c_seqHgh$c_seqHgh$c_seqLow$c_seqHgh$c_seqLow";
$c_bits[27]="$c_seqHgh$c_seqHgh$c_seqLow$c_seqHgh$c_seqHgh";
$c_bits[28]="$c_seqHgh$c_seqHgh$c_seqHgh$c_seqLow$c_seqLow";
$c_bits[29]="$c_seqHgh$c_seqHgh$c_seqHgh$c_seqLow$c_seqHgh";
$c_bits[30]="$c_seqHgh$c_seqHgh$c_seqHgh$c_seqHgh$c_seqLow";
$c_bits[31]="$c_seqHgh$c_seqHgh$c_seqHgh$c_seqHgh$c_seqHgh";


 
my ($state) = "$_[0]";
if ($state eq "on")
{
  system("echo \"TXP:$c_A,$c_G,$c_repeat,$c_pause,$c_tune,$c_baud,$c_bitLow,$c_bits[$c_master]$c_bits[$c_slave]$c_bitHgh,$c_AN,1,1,$c_speed,;\" | nc -u $c_ip $c_port & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}
else
{
  system("echo \"TXP:$c_A,$c_G,$c_repeat,$c_pause,$c_tune,$c_baud,$c_bitLow,$c_bits[$c_master]$c_bits[$c_slave]$c_bitHgh,$c_AUS,1,1,$c_speed,;\" | nc -u $c_ip $c_port & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}
}

sub bin2dec { return unpack("N", pack("B32", substr("0" x 32 . shift, -32))); }











######## trim #####################################################
# What  : cuts blankspaces from the beginning and end of a string
# Call  : { trim(" Hello ") }
# Source: http://www.somacon.com/p114.php ,
#         http://www.fhemwiki.de/wiki/TRIM-Funktion-Anfangs/EndLeerzeichen_aus_Strings_entfernen
sub trim($)
{
   my $string = shift;
   $string =~ s/^\s+//;
   $string =~ s/\s+$//;
   return $string;
}

######## ltrim ####################################################
# What  : cuts blankspaces from the beginning of a string
# Call  : { ltrim(" Hello") }
# Source: http://www.somacon.com/p114.php ,
#         http://www.fhemwiki.de/wiki/TRIM-Funktion-Anfangs/EndLeerzeichen_aus_Strings_entfernensub ltrim($)
sub ltrim($)
{
   my $string = shift;
   $string =~ s/^\s+//;
   return $string;
}

######## rtrim ####################################################
# What  : cuts blankspaces from the end of a string
# Call  : { rtrim("Hello ") }
# Source: http://www.somacon.com/p114.php ,
#         http://www.fhemwiki.de/wiki/TRIM-Funktion-Anfangs/EndLeerzeichen_aus_Strings_entfernensub ltrim($)
sub rtrim($)
{
   my $string = shift;
   $string =~ s/\s+$//;
   return $string;
}

######## UntoggleDirect ###########################################
# What  : For devices paired directly, converts state 'toggle' into 'on' or 'off'
# Call  : { UntoggleDirect("myDevice") }
#         define untoggle_myDevice notify myDevice { UntoggleDirect("myDevice") }
# Source: http://www.fhemwiki.de/wiki/FS20_Toggle_Events_auf_On/Off_umsetzen
sub UntoggleDirect($)
{
my ($obj) = shift;
Log 4, "UntoggleDirect($obj)";
if (Value($obj) eq "toggle"){
   if (OldValue($obj) eq "off") {
     {fhem ("setstate ".$obj." on")}
   }
   else {
     {fhem ("setstate ".$obj." off")}
   }
}
else {
   {fhem "setstate ".$obj." ".Value($obj)}

}


######## UntoggleIndirect #########################################
# What  : For devices paired indirectly, switches the target device 'on' or 'off' also when a 'toggle' was sent from the source device
# Call  : { UntoggleIndirect("mySensorDevice","myActorDevice","50%") }
#         define untoggle_mySensorDevice_myActorDevice notify mySensorDevice { UntoggleIndirect("mySensorDevice","myActorDevice","50%%") }
# Source: http://www.fhemwiki.de/wiki/FS20_Toggle_Events_auf_On/Off_umsetzen
sub UntoggleIndirect($$$)
{
  my ($sender, $actor, $dimvalue) = @_;
  Log 4, "UntoggleIndirect($sender, $actor, $dimvalue)";
  if (Value($sender) eq "toggle")
  {
    if (Value($actor) eq "off") {fhem ("set ".$actor." on")}
    else {fhem ("set ".$actor." off")}
  }
  ## workaround for dimming currently not working with indirect pairing
  ## (http://culfw.de/commandref.html: "TODO/Known BUGS - FS20 dim commands should not repeat.")
  elsif (Value($sender) eq "dimup") {fhem ("set ".$actor." dim100%")}
  elsif (Value($sender) eq "dimdown") {fhem ("set ".$actor." ".$dimvalue)}
  elsif (Value($sender) eq "dimupdown")
  {
    if (Value($actor) eq $dimvalue) {fhem ("set ".$actor." dim100%")}
       ## Heuristic above doesn't work if lamp was dimmed, then switched off, then switched on, because state is "on", but the lamp is actually dimmed.
    else {fhem ("set ".$actor." ".$dimvalue)}
    sleep 1;
  }
  ## end of workaround
  else {fhem ("set ".$actor." ".Value($sender))}

  return;
}


1;

=pod
=begin html

<a name="Utils"></a>
<h3>Utils</h3>
<ul>
   <br/>
   This is a collection of functions that can be used module-independant in all your own development<br/>
   </br>
   <pre>
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# IMPORTANT: do not insert your own functions inside
# the file 99_Utils.pm!
#
# This file will be overwritten during an FHEM update and all
# your own inserts will be lost.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# To avoid this, we recommend following procedure:
#
# 1. Create your own file 99_myUtils.pm from the template below
# 2. Put this file inside the ./FHEM directory
# 3. Put your own functions into this new file
#
<br/>
<code>
# start-of-template
package main;

use strict;
use warnings;
use POSIX;

sub
myUtils_Initialize($$)
{
   my ($hash) = @_;
}

# start with your own functions below this line


# behind your last function, we need the following
1;
# end-of-template
</code>
</pre>
</br>
   <b>Defined functions</b><br/><br/>
   <ul>
      <li><b>abstime2rel()</b><br>???</li><br/>
      <li><b>ltrim()</b><br>returns string without leading spaces</li><br/>
      <li><b>max()</b><br>returns the highest value from a given list (sorted alphanumeric)</li><br/>
      <li><b>maxNum()</b><br>returns the highest value from a given list (sorted numeric)</li><br/>
      <li><b>min()</b><br>returns the lowest value from a given list (sorted alphanumeric)</li><br/>
      <li><b>minNum()</b><br>returns the lowest value from a given list (sorted numeric)</li><br/>
      <li><b>rtrim()</b><br>returns string without trailing spaces</li><br/>
      <li><b>time_str2num()</b><br>???</li><br/>
      <li><b>trim()</b><br>returns string without leading and without trailing spaces</li><br/>
      <li><b>UntoggleDirect()</b><br>For devices paired directly, converts state 'toggle' into 'on' or 'off'</li><br/>
      <li><b>UntoggleIndirect()</b><br>For devices paired indirectly, switches the target device 'on' or 'off' <br/>
      also when a 'toggle' was sent from the source device</li><br/>
   </ul>
</ul>
=end html
=cut
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

rippi46

Hallo CarstenF

ich würde mal nur diesen Code in die 99_myUtils.pm einfügen.
Du musst dann noch deine IP-Adresse des Connair eintragen.



sub elro ($$$){
my ($Master,$Slave,$action) = @_;
my  $SendData="";
my    $sA=0;
my    $sG=0;
my    $sRepeat=10;
my    $sPause=5600;
my    $sTune=350;
my    $sBaud=25;
my    $sSpeed=16;
my    $uSleep=800000;
my    $txversion=2;
my    $HEAD="TXP:$sA,$sG,$sRepeat,$sPause,$sTune,$sBaud,";
my    $TAIL=",$txversion,1,$sSpeed,;";
my    $AN="1,3,1,3,3";
my    $AUS="3,1,1,3,1";
my    $bitLow=1;
my    $bitHgh=3;
my    $seqLow=$bitHgh.",".$bitHgh.",".$bitLow.",".$bitLow.",";
my    $seqHgh=$bitHgh.",".$bitLow.",".$bitHgh.",".$bitLow.",";
my    $i=0;
my    $bit="";   
my    $msg="";

my  $bits=$Master;
    for($i=0; $i<length($bits); $i++) {   
        $bit=substr($bits,$i,1);
        if($bit=="0") {
            $msg=$msg.$seqLow;
        } else {
            $msg=$msg.$seqHgh;
        }
    }
my    $msgM=$msg;
   
    $bits=$Slave;
   
    $msg="";
    for($i=0; $i<length($bits); $i++) {
        $bit=substr($bits,$i,1);
        if($bit=="0") {
            $msg=$msg.$seqLow;
        } else {
            $msg=$msg.$seqHgh;
        }
    }
my    $msgS=$msg;

    if($action eq "on") {
        $SendData = $HEAD.$bitLow.",".$msgM.$msgS.$bitHgh.",".$AN.$TAIL;
    } else {
        $SendData = $HEAD.$bitLow.",".$msgM.$msgS.$bitHgh.",".$AUS.$TAIL;
    }
my ($socket,$data);
#  We call IO::Socket::INET->new() to create the UDP Socket
$socket = new IO::Socket::INET(PeerAddr=>'192.168.178.40:49880',Proto=>'udp') or die "ERROR in Socket Creation : $!\n";
$socket->send($SendData);

$socket->close();

}



Aufruf dann in der fhem.cfg


define Wohnzimmerplayer dummy
attr Wohnzimmerplayer alias Wohnzimmerplayer
attr Wohnzimmerplayer eventMap BI:on B0:off
attr Wohnzimmerplayer fm_type smarttogglebutton,lamp
attr Wohnzimmerplayer group Lautsprecher
attr Wohnzimmerplayer icon audio_volume_low
attr Wohnzimmerplayer room Wohnzimmer,Sound
attr Wohnzimmerplayer setList state:on,off
define Wohnzimmerplayer_ntfy notify Wohnzimmerplayer:.* {\
    my $master = "11111";;\
    my $slave = "10100";;\
    my $v=Value("Wohnzimmerplayer");;\
    if ($v eq "on") {elro("$master","$slave","on")};;\
    if ($v eq "off") {elro("$master","$slave","off")};;\
    }
FHEM, LMS, VDR ,Dell 9010 Ubuntu 20.04,Raspimatic, HM/HMIP, Max, Elro, Brennenstuhl u. Intertechno mit Connair.
Picoreplayer, Raspi IR-Lanadapter, Firmata(wifi), LaCrosse,
nanocul433, nanocul868, Signalduino, Connexoon,
MySensor-GW+Sensoren, RGBWW, Zigbee2mqtt,Xiaomi,Nextion,LEDMatrix,Alexa

CarstenF

Hallo rippi46,

Vielen Dank schon mal. Werde heute nach dem Spätdienst Deine Codeschnipsel mal ausprobieren.
Reicht es eigentlich aus, wenn ich die Fhem.cfg neu einlese? Oder macht es Sinn einen kompletten Neustart zu machen?

Gruß Carsten
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

rippi46

#24
einfach in der Befehlszeile "shutdown restart" eingeben

PS: der Übersicht wegen die Inhalte der PM-Dateien als code angeben



FHEM, LMS, VDR ,Dell 9010 Ubuntu 20.04,Raspimatic, HM/HMIP, Max, Elro, Brennenstuhl u. Intertechno mit Connair.
Picoreplayer, Raspi IR-Lanadapter, Firmata(wifi), LaCrosse,
nanocul433, nanocul868, Signalduino, Connexoon,
MySensor-GW+Sensoren, RGBWW, Zigbee2mqtt,Xiaomi,Nextion,LEDMatrix,Alexa

CarstenF

Hallo rippi46,

Erstmal vielen Dank. Hat auf Anhieb funktioniert. Hatte die alten Einträge komplett gelöscht und Deine "Schnipsel" eingefügt. Nach den entsprechenden Codeänderungen und eintragen der IP, konnte ich die erste ELRO schalten. Jetzt werde ich mich mal ans umbenennen geben und dann nach und nach die Steckdosen einbinden. Ich habe auch noch ein paar Intertechnos. Da wird's dann bestimmt wieder spannend, aber ich bin da guter Dinge.
Auf jeden Fall beide Daumen hoch für die Hilfsbereitschaft!!

Gruß Carsten
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

rippi46

Hallo CarstenF

so sieht mein code für die intertechno aus


sub intertech {
my $c_ip = "192.168.178.40";
my $c_port = "49880";
my $c_A = "0";
my $c_G = "0";
my $c_repeat = "6";
my $c_pause = "11125";
my $c_tune = "89";
my $c_baud = "25";
my $c_speed = "125";
my $c_AN = "12,4,4,12,12,4";
my $c_AUS = "12,4,4,12,4,12";
my $c_master = "$_[1]";
my $c_slave = "$_[2]";
my $c_bitLow="4";
my $c_bitHgh="12";

my $c_seqLow="$c_bitHgh,$c_bitHgh,$c_bitLow,$c_bitLow,";
my $c_seqHgh="$c_bitHgh,$c_bitLow,$c_bitHgh,$c_bitLow,";


$c_bits[A]="$c_seqHgh$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[B]="$c_seqLow$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[C]="$c_seqHgh$c_seqLow$c_seqHgh$c_seqHgh";
$c_bits[D]="$c_seqLow$c_seqLow$c_seqHgh$c_seqHgh";

$c_bits[1]="$c_seqHgh$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[2]="$c_seqLow$c_seqHgh$c_seqHgh$c_seqHgh";
$c_bits[3]="$c_seqHgh$c_seqLow$c_seqLow$c_seqHgh";
   
my ($state) = "$_[0]";
if ($state eq "on")
{
  system("echo \"TXP:$c_A,$c_G,$c_repeat,$c_pause,$c_tune,$c_baud,$c_bitLow,$c_bits[$c_master]$c_bits[$c_slave]$c_seqHgh$c_seqLow$c_bitHgh,$c_AN,1,$c_speed,;\" | nc -u $c_ip $c_port & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}
else
{
  system("echo \"TXP:$c_A,$c_G,$c_repeat,$c_pause,$c_tune,$c_baud,$c_bitLow,$c_bits[$c_master]$c_bits[$c_slave]$c_seqHgh$c_seqLow$c_bitHgh,$c_AUS,1,$c_speed,;\" | nc -u $c_ip $c_port & pid=$! sleep 1 kill $pid 2>/dev/null >/dev/null");
}
}



und in der fhem.cfg


define LampeSchlaf dummy
attr LampeSchlaf alias Schlafzimmerlampe
attr LampeSchlaf eventMap BI:on B0:off
attr LampeSchlaf fm_type state,offbutton,onbutton
attr LampeSchlaf group Lampen
attr LampeSchlaf icon li_wht_on
attr LampeSchlaf room Schlafzimmer,Lampen
attr LampeSchlaf setList state:on,off
define LampeSchlaf_ntfy notify LampeSchlaf:.* {\
    my $master = "A";;\
    my $slave = "1";;\
    my $v=Value("LampeSchlaf");;\
    if ($v eq "on") {intertech("on","$master","$slave")};;\
    if ($v eq "off") {intertech("off","$master","$slave")};;\
    }

FHEM, LMS, VDR ,Dell 9010 Ubuntu 20.04,Raspimatic, HM/HMIP, Max, Elro, Brennenstuhl u. Intertechno mit Connair.
Picoreplayer, Raspi IR-Lanadapter, Firmata(wifi), LaCrosse,
nanocul433, nanocul868, Signalduino, Connexoon,
MySensor-GW+Sensoren, RGBWW, Zigbee2mqtt,Xiaomi,Nextion,LEDMatrix,Alexa

CarstenF

Da werde ich im Nachtdienst mal schön die Dateien vollschreiben. Ist echt ein tolles System. Nochmals Danke für die Hilfe.
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

CarstenF

#28
Hallo nochmal,
Also die Elros funktionieren jetzt alle. Klasse. :) Aber die Intertechno wollen nicht. Hatte die Codes so übernommen und natürlich die IP und die Schaltcodes angepasst. Aber der Connair wird nicht angesprochen. Woran könnte das denn liegen. Gibt es da unterschiedliche Arten von Intertechno Steckdosen?
Ach ja, Logfile zeigt keinen Fehler an.
Gruß Carsten
Raspberry Pi4
CUL 868, CUL 433, LaCrosse Gateway, Zigbeetomqtt2, HUE, Homematic
Max-Cube umgeflasht
MAX!, FhemtoFhem, Homebridge, FhemConnector, IR_Gateway und sonst auch noch allerlei Spielzeug....

rippi46

Hallo CarstenF,

das Einzigste woran ich mich noch erinnern kann war, dass ich die Intertechno in einen Lernmodus (pairen) versetzen musste.
Aber der Connair müsste auf jeden Fall so tun als wollte er die Intertechno schalten.
Soviel ich mich  noch erinnern kann, handelt normalerweise die Intertechno mit der Fernbedienung irgendein code aus.
Ich hatte sie einfach auf A1 eingestellt.
FHEM, LMS, VDR ,Dell 9010 Ubuntu 20.04,Raspimatic, HM/HMIP, Max, Elro, Brennenstuhl u. Intertechno mit Connair.
Picoreplayer, Raspi IR-Lanadapter, Firmata(wifi), LaCrosse,
nanocul433, nanocul868, Signalduino, Connexoon,
MySensor-GW+Sensoren, RGBWW, Zigbee2mqtt,Xiaomi,Nextion,LEDMatrix,Alexa