diff --git a/fhem/CHANGED b/fhem/CHANGED index 4e05a06d9..ebaccb6b5 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: ESPEasy: improved defineFn if bridge port is missing, docu update - feature: 37_Spotify: resume on target - feature: 93_DbRep: V5.1.0, create dumps of MySQL on client- or serverside, column UNIT is added to the result of fetchrows-command diff --git a/fhem/FHEM/34_ESPEasy.pm b/fhem/FHEM/34_ESPEasy.pm index bca1833d6..3af203c56 100644 --- a/fhem/FHEM/34_ESPEasy.pm +++ b/fhem/FHEM/34_ESPEasy.pm @@ -36,7 +36,7 @@ use Color; # ------------------------------------------------------------------------------ # global/default values # ------------------------------------------------------------------------------ -my $module_version = 1.19; # Version of this module +my $module_version = "1.20"; # Version of this module my $minEEBuild = 128; # informational my $minJsonVersion = 1.02; # checked in received data @@ -52,7 +52,10 @@ my $d_resendFailedCmd = 0; # resend failed http requests by default? my $d_displayTextEncode = 1; # urlEncode Text for Displays my $d_displayTextWidth = 0; # display width, 0 => disable formating +my $d_bridgePort = 8383; + # IP ranges that are allowed to connect to ESPEasy without attr allowedIPs set. +# defined as regexp beause it's quicker than check against IP ranges... my $d_allowedIPs = "192.168.0.0/16,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12," . "fe80::/10,fc00::/7,::1"; @@ -124,10 +127,9 @@ my %ESPEasy_setCmdsUsage = ( "status" => "status ", #https://forum.fhem.de/index.php/topic,55728.msg480966.html#msg480966 "pwmfade" => "pwmfade ", - ##https://forum.fhem.de/index.php/topic,55728.msg530220.html#msg530220 - #"irsend" => "irsend ", + #https://forum.fhem.de/index.php/topic,55728.msg530220.html#msg530220 #https://github.com/letscontrolit/ESPEasy/blob/mega/src/_P035_IRTX.ino - "irsend" => "irsend " + "irsend" => "irsend " . "| irsend ", "raw" => "raw <...>", "reboot" => "reboot", @@ -136,14 +138,14 @@ my %ESPEasy_setCmdsUsage = ( "statusrequest" => "statusRequest", "clearreadings" => "clearReadings", "help" => "help <".join("|", sort keys %ESPEasy_setCmds).">", - "lights" => "light [color] [fading time] [pct]", + "lights" => "lights [color] [fading time] [pct]", "dots" => "dots ", "tone" => "tone ", "rtttl" => "rtttl ", "dmx" => "dmx ", - "motorshieldcmd" => "motorshieldcmd ". - " ". - "", + "motorshieldcmd" => "motorshieldcmd " + . " " + . "", "candle" => "CANDLE:::", "neopixel" => "NeoPixel ", "neopixelall" => "NeoPixelAll ", @@ -296,20 +298,13 @@ sub ESPEasy_Define($$) # only called when defined, not on reload. my $name = $a[0]; my $type = $a[1]; my $host = $a[2]; - my $port = $a[3] if defined $a[3]; + my $port; + $port = $a[3] if defined $a[3]; + $port = 8383 if !defined $port && $host eq "bridge"; my $iodev = $a[4] if defined $a[4]; my $ident = $a[5] if defined $a[5]; - - my $ipv = ($port =~ m/^IPV6:/i ? 6 : 4) if defined $port; - $hash->{IPV} = $ipv; + my $ipv = $port =~ m/^IPV6:/ ? 6 : 4; - # Check OS IPv6 support - if ($ipv == 6) { - use constant HAS_AF_INET6 => defined eval { Socket::AF_INET6() }; - Log3 $name, 2, "$type $name: WARNING: Your system seems to have no IPv6 support." - if !HAS_AF_INET6; - } - return "ERROR: only 1 ESPEasy bridge can be defined!" if($host eq "bridge" && $modules{ESPEasy}{defptr}{BRIDGE}{$ipv}); return "ERROR: missing arguments for subtype device: $usg" @@ -336,8 +331,9 @@ sub ESPEasy_Define($$) # only called when defined, not on reload. #--- BRIDGE ------------------------------------------------- if ($hash->{HOST} eq "bridge") { $hash->{SUBTYPE} = "bridge"; + $hash->{IPV} = $ipv; $modules{ESPEasy}{defptr}{BRIDGE}{$ipv} = $hash; - Log3 $hash->{NAME}, 2, "$type $name: Opening bridge on port tcp/$port (v$module_version)"; + Log3 $hash->{NAME}, 2, "$type $name: Opening bridge port tcp/$port (v$module_version)"; ESPEasy_tcpServerOpen($hash); if ($init_done && !defined($hash->{OLDDEF})) { #if (not defined getKeyValue($type."_".$name."-firstrun")) { @@ -353,6 +349,14 @@ sub ESPEasy_Define($$) # only called when defined, not on reload. $hash->{MAX_HTTP_SESSIONS} = $d_maxHttpSessions; $hash->{MAX_QUEUE_SIZE} = $d_maxQueueSize; + # Check OS IPv6 support + if ($ipv == 6) { + use constant HAS_AF_INET6 => defined eval { Socket::AF_INET6() }; + Log3 $name, 2, "$type $name: WARNING: Your system seems to have no IPv6 support." + if !HAS_AF_INET6; + } + + # Check that GIT repository is not activated ESPEasy_removeGit($hash); } @@ -1641,9 +1645,9 @@ sub ESPEasy_TcpServer_Accept($$) # ------------------------------------------------------------------------------ # Removed from sub because we have our own access control system that works in -# a more readable and flexible way (network ranges with allow/deny vs regexp). +# a more readable and flexible way (network ranges with allow/deny and regexps). # Our new allowed ranges default are also now: -# 127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fe80::/10,::1 +# 127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7,fe80::/10,::1 # ------------------------------------------------------------------------------ # # my $af = $attr{$name}{allowfrom}; @@ -2241,7 +2245,7 @@ sub ESPEasy_urlEncodeDisplayText($$@) # collect all texts parameters for (my $i=$pp-1; $i<$c; $i++) { - $params[$i] =~ s/,/./g; # comma is http url parameter splitter + $params[$i] =~ s/,/./g; # comma is ESPEasy parameter splitter, can't be used push @t, $params[$i]; } my $text = join(" ", @t); @@ -2293,7 +2297,7 @@ sub ESPEasy_isAttrCombineDevices($) my @ranges = split(/,| /,$_[0]); foreach (@ranges) { if (!($_ =~ m/^([A-Za-z0-9_\.]|[A-Za-z0-9_\.][A-Za-z0-9_\.]*[A-Za-z0-9\._])$/ - || ESPEasy_isIPv64Range($_))) + || ESPEasy_isIPv64Range($_))) { return 0 } @@ -2973,7 +2977,7 @@ sub ESPEasy_removeGit($)
- Generic IO ESPEasy commands:

+ ESPEasy generic I/O commands:

  • GPIO
    @@ -3070,7 +3074,7 @@ sub ESPEasy_removeGit($)
- Motor control ESPEasy commands:

+ ESPEasy motor control commands:

  • Servo
    @@ -3097,7 +3101,7 @@ sub ESPEasy_removeGit($)
- Display related ESPEasy commands:
+ ESPEasy display related commands:

  • lcd
    @@ -3148,7 +3152,7 @@ sub ESPEasy_removeGit($)
- DMX related ESPEasy commands: + ESPEasy DMX related commands:

  • dmx
    @@ -3161,7 +3165,7 @@ sub ESPEasy_removeGit($)
- LED/Lights related ESPEasy commands: + ESPEasy LED/Lights related commands:

  • Lights (plugin can be found - Sound related ESPEasy commands: + ESPEasy sound related commands:

    • tone
      @@ -3251,7 +3255,7 @@ sub ESPEasy_removeGit($)
    - Miscellaneous ESPEasy commands: + ESPEasy miscellaneous commands:

    • Event
      @@ -3294,7 +3298,7 @@ sub ESPEasy_removeGit($)
    - Administrative ESPEasy commands (be careful !!!): + ESPEasy administrative commands (be careful !!!):

    • erase
      @@ -3323,7 +3327,7 @@ sub ESPEasy_removeGit($)
    - Experimental ESPEasy commands: (The following commands can be changed or removed at any time) + ESPEasy experimental commands: (The following commands can be changed or removed at any time)

    • rgb
      @@ -3358,7 +3362,7 @@ sub ESPEasy_removeGit($)
    - Deprecated ESPEasy commands: (will be removed in a later version) + ESPEasy deprecated commands: (will be removed in a later version)