Tuesday, August 11, 2015

ABC

Alphabet is about businesses prospering through strong leaders and independence. In general, our model is to have a strong CEO who runs each business, with Sergey and me in service to them as needed. We will rigorously handle capital allocation and work to make sure each business is executing well.
abc.xyz
Charlie and I mainly attend to capital allocation and the care and feeding of our key managers. Most of these managers are happiest when they are left alone to run their businesses, and that is customarily just how we leave them.
www.berkshirehathaway.com/owners.html

Sunday, July 05, 2015

Openhab alsa/amplifier link

A simple openhab script that monitors the ALSA sound device and switches on an amplifier if there is something playing. If there isn't anything playing, wait 10 minutes and then turn off.
.items
Switch WemoAmp "Amplifier" { wemo="WemoAmplifier" }


.rules


rule "Switch off amplifier if alsa not playing for 10min"
when
    Item Alsa_State changed or
    System started
then
     logInfo("alsaMonitor", "state changed: " + Alsa_State.state)

    if(Alsa_State.state=='STOPPED') {
       logInfo("alsaMonitor", "Start timer for amp switch off")
        timer = createTimer(now.plusMinutes(10)) [|
              logInfo("alsaMonitor", "Switch off amp")
              sendCommand(WemoAmp,OFF)
        ]   
    } else if(Alsa_State.state=='RUNNING') {
    if(timer!=null) {
        logInfo("alsaMonitor", "Cancel amp switch off")
        timer.cancel
        timer = null
        }   
    logInfo("alsaMonitor", "Turn on amp")
    sendCommand(WemoAmp,ON)
    }   
end