From ed36ddd216166e373ceadf4c7779ff67778a6b34 Mon Sep 17 00:00:00 2001 From: neumann <> Date: Tue, 30 May 2017 18:42:11 +0000 Subject: [PATCH] 37_Spotify: do not delete inactive device git-svn-id: https://svn.fhem.de/fhem/trunk@14428 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/37_Spotify.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/37_Spotify.pm b/fhem/FHEM/37_Spotify.pm index 68e35a2f8..83a46c2af 100644 --- a/fhem/FHEM/37_Spotify.pm +++ b/fhem/FHEM/37_Spotify.pm @@ -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}); }