mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
HUE: handle deCONZ scene-called event, fixed some warnings
git-svn-id: https://svn.fhem.de/fhem/trunk@21136 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
24453d7336
commit
f4d3f61444
@ -114,8 +114,9 @@ HUEBridge_Read($)
|
||||
$code = $name ."-". $id if( $obj->{r} eq 'lights' );
|
||||
$code = $name ."-S". $id if( $obj->{r} eq 'sensors' );
|
||||
$code = $name ."-G". $id if( $obj->{r} eq 'groups' );
|
||||
$code = $name ."-G". $obj->{gid} if( $obj->{r} eq 'scenes' && $obj->{gid} );
|
||||
if( !$code ) {
|
||||
Log3 $name, 5, "$name: ignoring event: $code";
|
||||
Log3 $name, 5, "$name: ignoring event: $data";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -134,8 +135,11 @@ HUEBridge_Read($)
|
||||
}
|
||||
|
||||
} elsif( $obj->{t} eq 'event' && $obj->{e} eq 'scene-called' ) {
|
||||
Log3 $name, 5, "$name: todo: handle websocket scene-called $data";
|
||||
# trigger scene event ?
|
||||
if( my $chash = $modules{HUEDevice}{defptr}{$code} ) {
|
||||
#HUEDevice_Parse($chash, $obj);
|
||||
HUEDevice_Parse($chash, { state => { scene => $obj->{scid} } } );
|
||||
#readingsSingleUpdate($hash, 'scene', $obj->{scid}, 1 );
|
||||
}
|
||||
|
||||
} elsif( $obj->{t} eq 'event' && $obj->{e} eq 'added' ) {
|
||||
Log3 $name, 5, "$name: websocket add: $data";
|
||||
@ -1957,12 +1961,12 @@ HUEBridge_dispatch($$$;$)
|
||||
|
||||
}
|
||||
|
||||
} elsif( $type =~ m/^lights\/(\d*)$/ ) {
|
||||
} elsif( $type =~ m/^lights\/(\d+)$/ ) {
|
||||
if( HUEDevice_Parse($param->{chash}, $json) ) {
|
||||
HUEBridge_updateGroups($hash, $param->{chash}{ID});
|
||||
}
|
||||
|
||||
} elsif( $type =~ m/^lights\/(\d*)\/bridgeupdatestate$/ ) {
|
||||
} elsif( $type =~ m/^lights\/(\d+)\/bridgeupdatestate$/ ) {
|
||||
# only for https://github.com/bwssytems/ha-bridge
|
||||
# see https://forum.fhem.de/index.php/topic,11020.msg961555.html#msg961555
|
||||
if( $queryAfterSet ) {
|
||||
@ -1976,13 +1980,13 @@ HUEBridge_dispatch($$$;$)
|
||||
}
|
||||
}
|
||||
|
||||
} elsif( $type =~ m/^groups\/(\d*)$/ ) {
|
||||
} elsif( $type =~ m/^groups\/(\d+)$/ ) {
|
||||
HUEDevice_Parse($param->{chash}, $json);
|
||||
|
||||
} elsif( $type =~ m/^sensors\/(\d*)$/ ) {
|
||||
} elsif( $type =~ m/^sensors\/(\d+)$/ ) {
|
||||
HUEDevice_Parse($param->{chash}, $json);
|
||||
|
||||
} elsif( $type =~ m/^lights\/(\d*)\/state$/ ) {
|
||||
} elsif( $type =~ m/^lights\/(\d+)\/state$/ ) {
|
||||
if( $queryAfterSet ) {
|
||||
my $chash = $param->{chash};
|
||||
if( $chash->{helper}->{update_timeout} ) {
|
||||
@ -1994,7 +1998,8 @@ HUEBridge_dispatch($$$;$)
|
||||
}
|
||||
}
|
||||
|
||||
} elsif( $type =~ m/^groups\/(\d*)\/action$/ ) {
|
||||
} elsif( $type =~ m/^groups\/(\d+)\/action$/
|
||||
|| $type =~ m/^groups\/(\d+)\/scenes\/(\d+)\/recall$/ ) {
|
||||
my $chash = $param->{chash};
|
||||
if( $chash->{helper}->{update_timeout} ) {
|
||||
RemoveInternalTimer($chash);
|
||||
|
@ -1385,7 +1385,6 @@ HUEDevice_Parse($$)
|
||||
$hash->{helper}{json} = $result;
|
||||
|
||||
if( $hash->{helper}->{devtype} eq 'G' ) {
|
||||
|
||||
#if( !defined($attr{$name}{subType}) && $hash->{type} ) {
|
||||
# if( $hash->{type} eq 'Room' ) {
|
||||
# $attr{$name}{subType} = 'room';
|
||||
@ -1608,8 +1607,8 @@ HUEDevice_Parse($$)
|
||||
$readings{valve} = ceil((100/255) * $state->{valve}) if( defined ($state->{valve}) );
|
||||
}
|
||||
|
||||
$hash->{lastupdated} = ReadingsVal( $name, '.lastupdated', undef ) if( !$hash->{lastupdated} );
|
||||
$hash->{lastupdated_local} = ReadingsVal( $name, '.lastupdated_local', undef ) if( !$hash->{lastupdated_local} );
|
||||
$hash->{lastupdated} = ReadingsVal( $name, '.lastupdated', '' ) if( !$hash->{lastupdated} );
|
||||
$hash->{lastupdated_local} = ReadingsVal( $name, '.lastupdated_local', '' ) if( !$hash->{lastupdated_local} );
|
||||
return undef if( $hash->{lastupdated}
|
||||
&& $hash->{lastupdated} eq $lastupdated
|
||||
&& (!$readings{state} || $readings{state} eq ReadingsVal( $name, 'state', '' )) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user