2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-30 18:12:28 +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 0a5623513f
commit ea6d3ff693

View File

@ -855,11 +855,12 @@ MQTT2_DEVICE_addPos($@)
##################################### #####################################
# Utility functions for the AttrTemplates # Utility functions for the AttrTemplates
sub sub
zigbee2mqtt_RGB2JSON($) zigbee2mqtt_RGB2JSON($;$)
{ {
my $rgb = shift(@_); my ($rgb,$trans) = shift(@_);
$rgb =~ m/^(..)(..)(..)/; $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 sub