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

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Controlling Amazon dash button via postlease.sh

Discussion in 'Asuswrt-Merlin' started by fun4stuff, Dec 6, 2017.

  1. fun4stuff

    fun4stuff Occasional Visitor

    Joined:
    Feb 18, 2017
    Messages:
    32
    Ive been using an Amazon dash button to control smart led lights Via this postlease.sh script:

    #!/bin/sh
    logger "amazon script running"
    NowLeasedMac=$2
    if [ "$NowLeasedMac" == "xx:xx:xx:xx:xx:xx" ]; then
    wget "https://maker.ifttt.com/trigger/xxxx/with/key/xxxx"
    logger "amazon script triggered"
    fi
    #

    If I wanted to add another Amazon dash button to control a second light, how would I modify the script to do it? I tried the following but it didn't work.


    #!/bin/sh
    logger "amazon script running"
    NowLeasedMac=$2
    if [ "$NowLeasedMac" == "xx:xx:xx:xx:xx:xx" ]; then
    wget "https://maker.ifttt.com/trigger/xxxx/with/key/xxxx"
    logger "amazon script triggered"
    fi

    if [ "$NowLeasedMac" == "Aa:Aa:Aa:Aa:Aa:Aa" ]; then
    wget "https://maker.ifttt.com/trigger/xxxx/with/key/Aaaa"
    logger "amazon script 2 triggered"
    fi


    #



    What am I missing? thanks
     
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. heliosone

    heliosone Occasional Visitor

    Joined:
    Jan 10, 2015
    Messages:
    36
    hi!

    Im using several dash buttons on my routers (ac56u/n66u) and it works flawless!
    i dont see the error in your script :(
    this is what I use :
    Code:
    #!/bin/sh
    
    NowLeasedMac=$2
    if [ "$NowLeasedMac" == "00:00:00:00:00:00" ]; then /jffs/scripts/shortcuts/amdash_actions/kleenex;touch /tmp/[email protected]$(date +%Y%m%d-%H:%M:%S);exit;fi
    if [ "$NowLeasedMac" == "00:00:00:00:00:00" ]; then /jffs/scripts/shortcuts/amdash_actions/duracell;touch /tmp/[email protected]$(date +%Y%m%d-%H:%M:%S);exit;fi
    if [ "$NowLeasedMac" == "00:00:00:00:00:00" ]; then /jffs/scripts/shortcuts/amdash_actions/finish;touch /tmp/[email protected]$(date +%Y%m%d-%H:%M:%S);exit;fi
    if [ "$NowLeasedMac" == "00:00:00:00:00:00" ]; then /jffs/scripts/shortcuts/amdash_actions/somat;touch /tmp/[email protected]$(date +%Y%m%d-%H:%M:%S);exit;fi
    if [ "$NowLeasedMac" == "00:00:00:00:00:00" ]; then /jffs/scripts/shortcuts/amdash_actions/niveamen;touch /tmp/[email protected]$(date +%Y%m%d-%H:%M:%S);exit;fi
    if [ "$NowLeasedMac" == "00:00:00:00:00:00" ]; then /jffs/scripts/shortcuts/amdash_actions/nivea;touch /tmp/[email protected]$(date +%Y%m%d-%H:%M:%S);exit;fi
    I dont like to spam my syslog,so I just create 0byte files with date/time/name when a button was pressed.
     
    fun4stuff likes this.
  4. fun4stuff

    fun4stuff Occasional Visitor

    Joined:
    Feb 18, 2017
    Messages:
    32
    Thanks!!
     
  5. fun4stuff

    fun4stuff Occasional Visitor

    Joined:
    Feb 18, 2017
    Messages:
    32
    Could you post an example of one of your script files (e.g. Kleenex)?
     
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!