mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
31_PLAYBULB: support for new devicetype, GardenaSmart bugfixes, UWZ replace Iconv
git-svn-id: https://svn.fhem.de/fhem/trunk@15650 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3e275e2323
commit
b8507e5b16
@ -1,5 +1,8 @@
|
||||
# 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.
|
||||
- bugfix: 73_GardenaSmart: v0.4.0 bugfixes
|
||||
- feature: 31_PLAYBULB: v1.4.0 support for Sphere Model BTL301w
|
||||
- change: 77_UWZ: v2.0.0, replace Iconv-Converter with perl encode()
|
||||
- change: 93_DbLog: V3.4.0, importCacheFile, addCacheLine use char filter
|
||||
(switch it on with attribute useCharfilter)
|
||||
- feature: 98_GOOGLECAST: support displaying websites on Chromecast
|
||||
|
@ -41,7 +41,7 @@ use Blocking;
|
||||
use SetExtensions;
|
||||
|
||||
|
||||
my $version = "1.2.8";
|
||||
my $version = "1.4.0";
|
||||
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@ my %playbulbModels = (
|
||||
BTL400M_v18 => {'aColor' => '0x23' ,'aEffect' => '0x21' ,'aBattery' => '0x2e' ,'aDevicename' => '0x7'}, # Garden
|
||||
BTL400M_v37 => {'aColor' => '0x1b' ,'aEffect' => '0x19' ,'aBattery' => '0x24' ,'aDevicename' => '0x7'}, # Garden neue Version
|
||||
BTL100C_v10 => {'aColor' => '0x1b' ,'aEffect' => '0x19' ,'aBattery' => 'none' ,'aDevicename' => 'none'}, # Color LED
|
||||
BTL301W => {'aColor' => '0x29' ,'aEffect' => '0x27' ,'aBattery' => '0x34' ,'aDevicename' => '0x3'}, # Sphere Model BTL 301 W
|
||||
);
|
||||
|
||||
my %effects = (
|
||||
@ -107,7 +108,7 @@ sub PLAYBULB_Initialize($) {
|
||||
$hash->{DefFn} = "PLAYBULB_Define";
|
||||
$hash->{UndefFn} = "PLAYBULB_Undef";
|
||||
$hash->{AttrFn} = "PLAYBULB_Attr";
|
||||
$hash->{AttrList} = "model:BTL300_v5,BTL300_v6,BTL201_v2,BTL201M_V16,BTL505_v1,BTL400M_v18,BTL400M_v37,BTL100C_v10,BTL305_v14 ".
|
||||
$hash->{AttrList} = "model:BTL300_v5,BTL300_v6,BTL201_v2,BTL201M_V16,BTL505_v1,BTL400M_v18,BTL400M_v37,BTL100C_v10,BTL305_v14,BTL301W ".
|
||||
"sshHost ".
|
||||
$readingFnAttributes;
|
||||
|
||||
|
@ -68,7 +68,7 @@ eval "use JSON;1" or $missingModul .= "JSON ";
|
||||
eval "use IO::Socket::SSL;1" or $missingModul .= "IO::Socket::SSL ";
|
||||
|
||||
|
||||
my $version = "0.2.8";
|
||||
my $version = "0.4.0";
|
||||
|
||||
|
||||
|
||||
|
@ -62,13 +62,10 @@ use strict;
|
||||
use warnings;
|
||||
use Time::Local;
|
||||
|
||||
use Data::Dumper; #debugging
|
||||
|
||||
# eval "use Encode qw(encode encode_utf8 decode_utf8);1" or $missingModul .= "Encode "; wird nicht benötigt
|
||||
eval "use JSON;1" or $missingModul .= "JSON ";
|
||||
|
||||
|
||||
my $version = "0.2.3";
|
||||
my $version = "0.4.0";
|
||||
|
||||
|
||||
|
||||
@ -102,6 +99,7 @@ sub GardenaSmartDevice_Initialize($) {
|
||||
$hash->{AttrFn} = "GardenaSmartDevice_Attr";
|
||||
$hash->{AttrList} = "readingValueLanguage:de,en ".
|
||||
"model ".
|
||||
"IODev ".
|
||||
$readingFnAttributes;
|
||||
|
||||
foreach my $d(sort keys %{$modules{GardenaSmartDevice}{defptr}}) {
|
||||
@ -115,39 +113,29 @@ sub GardenaSmartDevice_Define($$) {
|
||||
|
||||
my ( $hash, $def ) = @_;
|
||||
my @a = split( "[ \t]+", $def );
|
||||
splice( @a, 1, 1 );
|
||||
my $iodev;
|
||||
my $i = 0;
|
||||
|
||||
|
||||
foreach my $param ( @a ) {
|
||||
if( $param =~ m/IODev=([^\s]*)/ ) {
|
||||
|
||||
$iodev = $1;
|
||||
splice( @a, $i, 3 );
|
||||
last;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
return "too few parameters: define <NAME> GardenaSmartDevice <device_Id> <model>" if( @a != 3 ) ;
|
||||
return "too few parameters: define <NAME> GardenaSmartDevice <device_Id> <model>" if( @a < 3 ) ;
|
||||
return "Cannot define Gardena Bridge device. Perl modul $missingModul is missing." if ( $missingModul );
|
||||
|
||||
my ($name,$deviceId,$category) = @a;
|
||||
|
||||
my $name = $a[0];
|
||||
my $deviceId = $a[2];
|
||||
my $category = $a[3];
|
||||
|
||||
$hash->{DEVICEID} = $deviceId;
|
||||
$hash->{VERSION} = $version;
|
||||
|
||||
|
||||
|
||||
CommandAttr(undef,"$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}") if(AttrVal($name,'IODev','none') eq 'none');
|
||||
|
||||
my $iodev = AttrVal($name,'IODev','none');
|
||||
|
||||
AssignIoPort($hash,$iodev) if( !$hash->{IODev} );
|
||||
|
||||
if(defined($hash->{IODev}->{NAME})) {
|
||||
|
||||
Log3 $name, 3, "GardenaSmartDevice ($name) - I/O device is " . $hash->{IODev}->{NAME};
|
||||
|
||||
} else {
|
||||
|
||||
Log3 $name, 1, "GardenaSmartDevice ($name) - no I/O device";
|
||||
}
|
||||
|
||||
@ -158,6 +146,7 @@ sub GardenaSmartDevice_Define($$) {
|
||||
return "GardenaSmartDevice device $name on GardenaSmartBridge $iodev already defined."
|
||||
if( defined($d) && $d->{IODev} == $hash->{IODev} && $d->{NAME} ne $name );
|
||||
|
||||
|
||||
$attr{$name}{room} = "GardenaSmart" if( not defined( $attr{$name}{room} ) );
|
||||
$attr{$name}{model} = $category if( not defined( $attr{$name}{model} ) );
|
||||
|
||||
@ -313,9 +302,8 @@ sub GardenaSmartDevice_Parse($$) {
|
||||
|
||||
} else {
|
||||
|
||||
Log3 $name, 3, "GardenaSmartDevice ($name) - autocreate new device " . makeDeviceName($decode_json->{name}) . " with deviceId $decode_json->{id}, model $decode_json->{category} and IODev IODev=$name";
|
||||
#return "UNDEFINED " . join('',split("[ \t]+",$decode_json->{name})) . " GardenaSmartDevice $decode_json->{id} $decode_json->{category} IODev=$name";
|
||||
return "UNDEFINED " . makeDeviceName($decode_json->{name}) . " GardenaSmartDevice $decode_json->{id} $decode_json->{category} IODev=$name";
|
||||
Log3 $name, 3, "GardenaSmartDevice ($name) - autocreate new device " . makeDeviceName($decode_json->{name}) . " with deviceId $decode_json->{id}, model $decode_json->{category}";
|
||||
return "UNDEFINED " . makeDeviceName($decode_json->{name}) . " GardenaSmartDevice $decode_json->{id} $decode_json->{category}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
# Special thanks goes to comitters:
|
||||
# - Marko Oldenburg (leongaultier at gmail dot com)
|
||||
# - Hanjo (Forum) patch for sort by creation
|
||||
# - cb1 <kontakt@it-buchinger.de> patch Replace Iconv with native perl encode()
|
||||
#
|
||||
# Storm warnings from unwetterzentrale.de
|
||||
# inspired by 59_PROPLANTA.pm
|
||||
@ -53,7 +54,6 @@ eval "use HTTP::Request;1" or $missingModul .= "HTTP::Request ";
|
||||
eval "use HTML::Parser;1" or $missingModul .= "HTML::Parser ";
|
||||
eval "use JSON;1" or $missingModul .= "JSON ";
|
||||
eval "use Encode::Guess;1" or $missingModul .= "Encode::Guess ";
|
||||
eval "use Text::Iconv;1" or $missingModul .= "Text::Iconv ";
|
||||
|
||||
require 'Blocking.pm';
|
||||
require 'HttpUtils.pm';
|
||||
@ -61,7 +61,7 @@ use vars qw($readingFnAttributes);
|
||||
|
||||
use vars qw(%defs);
|
||||
my $MODUL = "UWZ";
|
||||
my $version = "1.8.0";
|
||||
my $version = "2.0.0";
|
||||
|
||||
|
||||
|
||||
@ -772,7 +772,6 @@ sub UWZ_Run($) {
|
||||
my $response = UWZ_JSONAcquire($hash,$hash->{URL});
|
||||
|
||||
UWZ_Log $hash, 5, length($response)." characters captured";
|
||||
my $converter = Text::Iconv->new("windows-1252","UTF-8");
|
||||
my $uwz_warnings = JSON->new->ascii->decode($response);
|
||||
my $enc = guess_encoding($uwz_warnings);
|
||||
|
||||
@ -938,10 +937,12 @@ sub UWZ_Run($) {
|
||||
$message .= "Warn_".$i."_levelName|".$single_warning->{'payload'}{'levelName'}."|";
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_AltitudeMin: ".$enc->decode($single_warning->{'payload'}{'altMin'});
|
||||
$message .= "Warn_".$i."_AltitudeMin|".$converter->convert($single_warning->{'payload'}{'altMin'})."|";
|
||||
|
||||
$message .= "Warn_".$i."_AltitudeMin|".encode("UTF-8", decode("iso-8859-1", $single_warning->{'payload'}{'altMin'}))."|";
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_AltitudeMax: ".$enc->decode($single_warning->{'payload'}{'altMax'});
|
||||
$message .= "Warn_".$i."_AltitudeMax|".$converter->convert($single_warning->{'payload'}{'altMax'})."|";
|
||||
|
||||
$message .= "Warn_".$i."_AltitudeMax|".encode("UTF-8", decode("iso-8859-1", $single_warning->{'payload'}{'altMax'}))."|";
|
||||
|
||||
my $uclang = "EN";
|
||||
if (AttrVal( $name, 'lang',undef) ) {
|
||||
@ -955,10 +956,12 @@ sub UWZ_Run($) {
|
||||
}
|
||||
}
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_LongText: ".$enc->decode($single_warning->{'payload'}{'translationsLongText'}{$uclang});
|
||||
$message .= "Warn_".$i."_LongText|".$converter->convert($single_warning->{'payload'}{'translationsLongText'}{$uclang})."|";
|
||||
|
||||
$message .= "Warn_".$i."_LongText|".encode("UTF-8", decode("iso-8859-1", $single_warning->{'payload'}{'translationsLongText'}{$uclang}))."|";
|
||||
|
||||
UWZ_Log $hash, 4, "Warn_".$i."_ShortText: ".$enc->decode($single_warning->{'payload'}{'translationsShortText'}{$uclang});
|
||||
$message .= "Warn_".$i."_ShortText|".$converter->convert($single_warning->{'payload'}{'translationsShortText'}{$uclang})."|";
|
||||
|
||||
$message .= "Warn_".$i."_ShortText|".encode("UTF-8", decode("iso-8859-1", $single_warning->{'payload'}{'translationsShortText'}{$uclang}))."|";
|
||||
|
||||
###
|
||||
if (AttrVal( $name, 'localiconbase',undef) ) {
|
||||
@ -1530,7 +1533,7 @@ sub UWZSearchAreaID($$) {
|
||||
A maximum of 10 thunderstorm warnings will be served.
|
||||
Additional the module provides a few functions to create HTML-Templates which can be used with weblink.
|
||||
<br>
|
||||
<i>The following Perl-Modules are used within this module: HTTP::Request, LWP::UserAgent, JSON, Encode::Guess, Text::Iconv und HTML::Parse</i>.
|
||||
<i>The following Perl-Modules are used within this module: HTTP::Request, LWP::UserAgent, JSON, Encode::Guess und HTML::Parse</i>.
|
||||
<br/><br/>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
@ -1950,7 +1953,7 @@ sub UWZSearchAreaID($$) {
|
||||
Es werden maximal 10 Standortbezogene Unwetterwarnungen zur Verfügung gestellt.
|
||||
Weiterhin verfügt das Modul über HTML-Templates welche als weblink verwendet werden können.
|
||||
<br>
|
||||
<i>Es nutzt die Perl-Module HTTP::Request, LWP::UserAgent, JSON, Encode::Guess, Text::Iconv und HTML::Parse</i>.
|
||||
<i>Es nutzt die Perl-Module HTTP::Request, LWP::UserAgent, JSON, Encode::Guess und HTML::Parse</i>.
|
||||
<br/><br/>
|
||||
<b>Define</b>
|
||||
<ul>
|
||||
|
Loading…
Reference in New Issue
Block a user