I am not sure if there are others out there that would want to do something like this, but I am sharing to help ones that do, or spark ideas for others.
We have a Russound zone in our bathroom and I was noticing that the audio was kinda getting drowned out by the fan when it was running (I have the fan automated based off humidity, so it turns on almost instantly when the shower is running). I decided to put a simple script together to bump up the audio a bit when the fan is running. It also turns the audio down when the fan is turned off. I have it set to adjust the audio by 2 points, which is barely noticeable, but enough to get over the noise of the fan. I have 2 events to run this script, when to look at fan changes and one to look at when the zone is turned on/off (fan may already be on before audio is turned on).
It's not much, but hope it helps someone.
We have a Russound zone in our bathroom and I was noticing that the audio was kinda getting drowned out by the fan when it was running (I have the fan automated based off humidity, so it turns on almost instantly when the shower is running). I decided to put a simple script together to bump up the audio a bit when the fan is running. It also turns the audio down when the fan is turned off. I have it set to adjust the audio by 2 points, which is barely noticeable, but enough to get over the noise of the fan. I have 2 events to run this script, when to look at fan changes and one to look at when the zone is turned on/off (fan may already be on before audio is turned on).
It's not much, but hope it helps someone.
Code:
Sub Main (parm as object) Dim speaker_level as integer 'Initial Audio Volume Level Dim fan_status as integer 'Fan on/off Dim new_speaker_level as integer 'New Audio Volume Level Dim speaker_status as integer 'Zone on/off speaker_level = hs.devicevalue(1381) 'Change to reflect Zone volume Device Ref new_speaker_level = 0 speaker_status = hs.devicevalue(1378) 'Change to reflect Zone on/off Device Ref fan_status = hs.devicevalue(248) 'Change to reflect fan on/off Device Ref If speaker_status = 100 then 'Bathroom Zone is On If fan_status = 255 then 'Fan is On new_speaker_level = speaker_level + 2 'Takes current volume and adds 2, can be changed to whatever you like hs.PluginFunction("BLRussound", "", "SetZoneVolume", New Object(){1,5,new_speaker_level}) 'Change the "5" to whatever your zone # is hs.writelog("Volume Bathroom", "Volume has been increased to " & new_speaker_level & ".") Else 'Fan is off new_speaker_level = speaker_level - 2 'Takes current volume and subtracts 2, can be changed to whatever you like hs.PluginFunction("BLRussound", "", "SetZoneVolume", New Object(){1,5,new_speaker_level}) 'Change the "5" to whatever your zone # is hs.writelog("Volume Bathroom", "Volume has been decreased to " & new_speaker_level & ".") End If Else 'Bathroom Zone is Off, Don't do anything hs.writelog ("Volume Bathroom", "Russound Audio is off, volume will not be adjusted.") 'Do Nothing End If hs.writelog("Volume Test", "Original Speaker Level: " & speaker_level & ". New Speaker Level: " & new_speaker_level &".") End Sub
Comment