mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
mqtt2.template: updates to WLED controller
git-svn-id: https://svn.fhem.de/fhem/trunk@27121 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cc244633b2
commit
04cd8718f0
@ -5244,6 +5244,7 @@ order:W_01
|
|||||||
{ Svn_GetFile('contrib/AttrTemplate/99_attrT_WLED_Utils.pm', 'FHEM/99_attrT_WLED_Utils.pm', sub(){ CommandReload(undef, '99_attrT_WLED_Utils') }) }
|
{ Svn_GetFile('contrib/AttrTemplate/99_attrT_WLED_Utils.pm', 'FHEM/99_attrT_WLED_Utils.pm', sub(){ CommandReload(undef, '99_attrT_WLED_Utils') }) }
|
||||||
par:BASE_ID;BASE_ID typically is wled;{ AttrVal('DEVICE','readingList','') =~ m,([^:]+)[/][^/]+[/][^/]+:, ? $1 : undef }
|
par:BASE_ID;BASE_ID typically is wled;{ AttrVal('DEVICE','readingList','') =~ m,([^:]+)[/][^/]+[/][^/]+:, ? $1 : undef }
|
||||||
par:DEVNAME;Device name as configured;{ AttrVal('DEVICE','readingList','') =~ m,[^:]+[/]([^/]+)[/][^/]+:, ? $1 : undef }
|
par:DEVNAME;Device name as configured;{ AttrVal('DEVICE','readingList','') =~ m,[^:]+[/]([^/]+)[/][^/]+:, ? $1 : undef }
|
||||||
|
par:IPADDRESS;Insert Controller-IP ;{ my $ip =InternalVal('DEVICE',InternalVal('DEVICE','LASTInputDev',AttrVal('DEVICE','IODev',InternalVal('DEVICE','IODev',undef)->{NAME})).'_CONN',ReadingsVal('DEVICE','ip', '')); $ip=~ m/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/x ? $1 : undef }
|
||||||
par:ICON;ICON as set, defaults to hue_filled_iris;{ AttrVal('DEVICE','icon','hue_filled_iris') }
|
par:ICON;ICON as set, defaults to hue_filled_iris;{ AttrVal('DEVICE','icon','hue_filled_iris') }
|
||||||
attr DEVICE icon ICON
|
attr DEVICE icon ICON
|
||||||
attr DEVICE setList\
|
attr DEVICE setList\
|
||||||
@ -5286,9 +5287,10 @@ attr DEVICE webCmdLabel RGB:Brightness\
|
|||||||
attr DEVICE setStateList on off toggle dimdown dimup effect_prev effect_next effect_random palette_prev palette_next palette_random palette_reset effect_reset
|
attr DEVICE setStateList on off toggle dimdown dimup effect_prev effect_next effect_random palette_prev palette_next palette_random palette_reset effect_reset
|
||||||
attr DEVICE comment For questions about the use of different widgets for color selection see discussion at https://forum.fhem.de/index.php/topic,98880.msg995308.html
|
attr DEVICE comment For questions about the use of different widgets for color selection see discussion at https://forum.fhem.de/index.php/topic,98880.msg995308.html
|
||||||
set DEVICE attrTemplate speechcontrol_type_light_255
|
set DEVICE attrTemplate speechcontrol_type_light_255
|
||||||
|
setreading DEVICE ip IPADDRESS
|
||||||
farewell:template has been applied successfully. Note: webCmd and eventMap are just examples; adopt this to your needs.
|
farewell:template has been applied successfully. Note: webCmd and eventMap are just examples; adopt this to your needs.
|
||||||
attr DEVICE model wled_controller
|
attr DEVICE model wled_controller
|
||||||
setreading DEVICE attrTemplateVersion 20211220
|
setreading DEVICE attrTemplateVersion 20230125
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ sub WLED_get {
|
|||||||
url=>"http://$ip/json",
|
url=>"http://$ip/json",
|
||||||
callback=>sub($$$){
|
callback=>sub($$$){
|
||||||
my ($hash,$err,$data) = @_;
|
my ($hash,$err,$data) = @_;
|
||||||
WLED_setReadings($dev,$data);
|
WLED_setReadings($dev,$data,$ip);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return defined $event ? $c : undef;
|
return defined $event ? $c : undef;
|
||||||
@ -69,6 +69,7 @@ sub WLED_get {
|
|||||||
sub WLED_setReadings {
|
sub WLED_setReadings {
|
||||||
my $dev = shift // return;
|
my $dev = shift // return;
|
||||||
my $data = shift // return;
|
my $data = shift // return;
|
||||||
|
my $ip = shift;
|
||||||
my $fx = $data =~ m/effects..\[([^[]*?)]/x ? WLED_subst($1) : '';
|
my $fx = $data =~ m/effects..\[([^[]*?)]/x ? WLED_subst($1) : '';
|
||||||
my $pl = $data =~ m/palettes..\[([^[]*?)]/x ? WLED_subst($1) : '';
|
my $pl = $data =~ m/palettes..\[([^[]*?)]/x ? WLED_subst($1) : '';
|
||||||
my $hash = $defs{$dev};
|
my $hash = $defs{$dev};
|
||||||
@ -83,6 +84,7 @@ sub WLED_setReadings {
|
|||||||
readingsBulkUpdateIfChanged($hash,'.effects',$fx);
|
readingsBulkUpdateIfChanged($hash,'.effects',$fx);
|
||||||
readingsBulkUpdateIfChanged($hash,'.palettescount',(scalar @p)-1);
|
readingsBulkUpdateIfChanged($hash,'.palettescount',(scalar @p)-1);
|
||||||
readingsBulkUpdateIfChanged($hash,'.palettes',$pl);
|
readingsBulkUpdateIfChanged($hash,'.palettes',$pl);
|
||||||
|
readingsBulkUpdateIfChanged($hash,'ip',$ip) if defined $ip;
|
||||||
readingsEndUpdate($hash,0);
|
readingsEndUpdate($hash,0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -99,10 +101,10 @@ sub WLED_set {
|
|||||||
my $dev = shift // return;
|
my $dev = shift // return;
|
||||||
my $read = shift // return;
|
my $read = shift // return;
|
||||||
my $val = shift // return;
|
my $val = shift // return;
|
||||||
my $wled = lc(InternalVal($dev,'CID',undef)) // return;
|
my $cid = InternalVal($dev,'CID',undef) // return;
|
||||||
|
my @wled = split('_',$cid);
|
||||||
my $arr = ReadingsVal($dev,'.'.$read.'s',undef) // return WLED_get($dev);
|
my $arr = ReadingsVal($dev,'.'.$read.'s',undef) // return WLED_get($dev);
|
||||||
$wled =~ s/_/\//;
|
my $top = lc($wled[0]).'/'.$wled[1].'/api F';
|
||||||
my $top = $wled.'/api F';
|
|
||||||
$top .= $read eq 'effect'?'X=':'P=';
|
$top .= $read eq 'effect'?'X=':'P=';
|
||||||
my $id;
|
my $id;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user