2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-14 09:35:29 +00:00

10_MQTT2_DEVICE.pm: transition parameter in zigbee2mqtt_RGB2JSON (Forum #129932)

git-svn-id: https://svn.fhem.de/fhem/trunk@26607 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-10-28 11:27:12 +00:00
parent 1231d595c5
commit 5c531ee3b4

View File

@ -855,11 +855,12 @@ MQTT2_DEVICE_addPos($@)
#####################################
# Utility functions for the AttrTemplates
sub
zigbee2mqtt_RGB2JSON($)
zigbee2mqtt_RGB2JSON($;$)
{
my $rgb = shift(@_);
my ($rgb,$trans) = shift(@_);
$rgb =~ m/^(..)(..)(..)/;
return toJSON({'transition'=>1, 'color'=>{r=>hex($1),g=>hex($2),b=>hex($3)}});
return toJSON({'transition'=>defined($trans) ? $trans : 1,
'color'=>{r=>hex($1),g=>hex($2),b=>hex($3)}});
}
sub