1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tomato and Home Automation

Discussion in 'Tomato Firmware' started by devlin016, Aug 21, 2013.

  1. devlin016

    devlin016 Networkin' Nut Member

    Does anyone think tomato would be able to control some smart home devices? My idea is at certain times of the day turn on/off lights or what ever I need. Like maybe for the lighting it would control phillip hue led light bulbs through the api http://developers.meethue.com/1_lightsapi.html
    if this seems like worth doing I will greatly expand the idea.
    so far all I accomplished is a bash script that checks for wifi association of my mobile phone to tell if im home or not when theres a association it will send a wol packet to my desktop. please any input would be greatly appreciated.
     
  2. devlin016

    devlin016 Networkin' Nut Member

    heres my script so far. so you can get a better idea of what im talking about.

    Code:
    #!/bin/bash
    if [ ! -d "/tmp/SmarTech" ]; then
        echo Smart Script Started>>/tmp/USBKey_Smart.log
        mkdir /tmp/SmarTech
        echo Getting Smart
    fi
    if [ -f "/tmp/nosmartech" ]; then
        exit
        echo Smart Script Stopped>>/tmp/USBKey_Smart.log
    fi
    
    #Variables
    Time=`date +%k%M`
    AnyoneCheck=`wl assoclist | grep -v EXCLUDESMARTDEVICESMACHERE | wc -l`
    DevlinCheck=`wl assoclist | grep D8:5D:4C:B4:32:4F | wc -l`
    DevlinFile=/tmp/SmarTech/devlin.db
    
    #IndividualConnections
    
    if [ $DevlinCheck -eq 1 ];
    then
        if [ ! -f "/tmp/SmarTech/devlin.db" ];
            then
                echo "Devlin just connected"
                echo 'Connected'>>$DevlinFile
                Devlin=JustConnected
            else
            echo "Devlin has been home"
            Devlin=BeenConnected
        fi
    else
      echo "Devlin isnt home"
      if [ -f $DevlinFile ]; then
        rm -f $DevlinFile
        Devlin=JustDisconnected
          else
        Devlin=BeenDisconnected
      fi
    fi
    
    #TechCheck
    
    if [ "$Devlin" = "JustConnected" ]; then
      sh /tmp/mnt/OPTWARE/smartech/tech/devlin/Init.sh
    fi
    
    if [ "$Devlin" = "JustDisconnected" ]; then
      sh /tmp/mnt/OPTWARE/smartech/tech/devlin/Halt.sh
    fi
    
    #ScheduledEvents
    
    
    #IsAnyoneHomeCheck
    
    if [ -f $DevlinFile ]; then
    SomeoneHome=Yes
    fi
    
    if [ $AnyoneCheck -eq 0 ];
    then
        echo "No one is home"
        SomeoneHome=No
        #TURNOFF ALL TECH COMMAND HERE
    fi
    
    #WriteLog
    echo "Devlin=$Devlin">/tmp/SmarTech/system.db
    echo "AnyoneHome=$SomeoneHome">/tmp/SmarTech/system.db
    
    #Loop
    sleep 30
    clear
    exec sh /tmp/mnt/OPTWARE/smartech/GetSmart.sh
    exit 
     
  3. koitsu

    koitsu Network Guru Member

    This is what X10 was designed for. There are tons of open-source programs, scripts, etc. available that provide the user interface/capability as long as the device is networked and supports said protocol; anything else is proprietary and downright silly. Search Google for "X10 protocol" and "X10 lights cgi" for some examples.
     
  4. devlin016

    devlin016 Networkin' Nut Member

    I dont know anything about X10 I was hoping I could find wifi enabled smart gear and just do api calls or something like that?
     
  5. koitsu

    koitsu Network Guru Member

    I cannot help past this point.
     

Share This Page