37_Spotify: added volume reading

git-svn-id: https://svn.fhem.de/fhem/trunk@14483 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
neumann
2017-06-09 05:22:09 +00:00
parent 231725a96b
commit cc8ef74415

View File

@@ -807,6 +807,7 @@ sub Spotify_dispatch($$$) {
if($device->{is_active}) {
Spotify_saveDevice($hash, $device, "device_active", 0);
readingsBulkUpdateIfChanged($hash, 'volume', $device->{volume_percent});
$hash->{helper}{device_active} = $device; # found active device
}
@@ -855,6 +856,7 @@ sub Spotify_dispatch($$$) {
if($hash->{helper}{is_active}) {
my $device = $json->{device};
$hash->{helper}{device_active} = $device;
readingsBulkUpdateIfChanged($hash, 'volume', $device->{volume_percent});
Spotify_saveDevice($hash, $device, "device_active", 0);
} else {
delete $hash->{helper}{device_active};