Announcement

Collapse
No announcement yet.

How To: Auto Adjust Audio for Bathroom Fan

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To: Auto Adjust Audio for Bathroom Fan

    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.

    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

    #2
    Wow - that is really cool! Thanks for sharing - I will add this when my bathroom is finally finished...

    Comment


      #3
      Originally posted by waynehead99 View Post
      ... I have the fan automated based off humidity, so it turns on almost instantly when the shower is running)
      I did not even think about his one... I have to do this now in the kid's bathroom... What sensor are you using to get the humidity? I have a couple zooz sensors that do motion, light, humidity and temp. I could use it but it seems to report in at odd times so not as "instantly" as I would like.

      Thanks for the idea. Now we need a sensor for the other time the fan should come on...
      HS3Pro & HS4Pro on Win2012R2
      Aeotec, Cooper, Cree, GE/Jasco, Intermatic, LIFX, Fortrezz, OSRAM, RCS, Trane, Zooz
      BLBackup, BLGData, BLRussound, BLSpeech, HSTouch, InvisaLink, HSBuddy, IFTTT, JowiHue, NetCAM, PHLocation, Pushover 3P, Random, rnbWeather, UltraLighting3, weatherXML, ZigBee, Z-Wave

      Comment

      Working...
      X