mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
37_Spotify: do not delete inactive device
git-svn-id: https://svn.fhem.de/fhem/trunk@14428 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
31bb21adf2
commit
ed36ddd216
@ -817,13 +817,10 @@ sub Spotify_dispatch($$$) {
|
||||
if(defined $json->{device} && $json->{device}{is_active}) {
|
||||
my $device = $json->{device};
|
||||
$hash->{helper}{device_active} = $device;
|
||||
readingsBulkUpdateIfChanged($hash, 'device_active_id', $device->{id}, 1);
|
||||
readingsBulkUpdateIfChanged($hash, 'device_active_name', $device->{name}, 1);
|
||||
readingsBulkUpdateIfChanged($hash, 'device_active_volume', $device->{volume_percent}, 1);
|
||||
readingsBulkUpdateIfChanged($hash, 'device_active_type', $device->{type}, 1);
|
||||
Spotify_saveDevice($hash, $device, "device_active", 0);
|
||||
} else {
|
||||
delete $hash->{helper}{device_active};
|
||||
CommandDeleteReading(undef, "$name device_active_.*");
|
||||
Spotify_saveDevice($hash, {id => "none", "name" => "none", "volume_percent" => -1, "type" => "none"}, 'device_active', 0) if(!defined $hash->{helper}{device_active});
|
||||
$hash->{STATE} = 'connected' if(!defined $json->{device});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user