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!

[Amazon Dash Button - DNSMASQ Problem]

Discussion in 'Asuswrt-Merlin' started by StefanP, Apr 6, 2020.

  1. StefanP

    StefanP New Around Here

    Joined:
    Apr 6, 2020
    Messages:
    8
    Hello,

    i have buy for few days my ASUS AC88U Router and flash them with "asus merlin".
    Network Speed is on 2.4 and 5.0 GHZ Band perfectly.

    I have found a Amazon Dashbutton its connect to 2.4GHZ and block internet access.
    I found few "scripts" to load a action when the Button is pressed but DNSMASQ give me an error and
    the few wlan devices cant login into wlan.

    May 5 07:17:16 custom_config: Appending content of /jffs/configs/dnsmasq.conf.add.
    May 5 07:17:16 dnsmasq[3182]: illegal repeated keyword at line 42 of /etc/dnsmasq.conf
    May 5 07:17:16 dnsmasq[3182]: FAILED to start up

    On:
    /jffs/configs/dnsmasq.conf.add file with this line :
    dhcp-script=/jffs/a/post-lease.sh

    On:
    /jffs/a/post-lease.sh
    #!/bin/sh
    # just for testing
    # touch /tmp/0_script_test
    NowLeasedMac=$2
    if [ “$NowLeasedMac” == “10:B3:32:42:55:62” ]; then
    #Do what you want here when dashbutton pressed.
    #e.g. I switch on-off my squeezebox player.

    wget http://10.10.1.204/cm?user=demo&password=demo&cmnd=Power Off
    echo “Caught !”
    fi


    Its a Sonoff behind with the cm? command to put it offline when is online.

    Cant help me? Thanks
     
  2. Maverickcdn

    Maverickcdn Regular Contributor

    Joined:
    Mar 14, 2018
    Messages:
    141
    Because /etc/dnsmasq.conf (default dnsmasq config file) already contains a 'dhcp-script=' directive in it
     
    Vexira and StefanP like this.
  3. CaptainSTX

    CaptainSTX Part of the Furniture

    Joined:
    May 2, 2012
    Messages:
    2,499
    If you are using a dedicated DASH button Amazon discontinued supporting them several months ago at least in the USA. They no longer work. They are electronic trash now.

    If you log into your Amazon account you can still use virtual DASH buttons but Amazon really wants you to ask Alexa to get you what you need

    To bad as my wife really liked the real buttons.
     
  4. StefanP

    StefanP New Around Here

    Joined:
    Apr 6, 2020
    Messages:
    8
    Can you help me to fix the problem?
    When the button is pressed than call with wget the "tasmota" url to activate oder deaktivate the light.

    @CaptainSTX
    Yes you have right, the Amazon Dashbutton is deactivated and electronic trash now.
    When you connected to amazon and press the button to order -> is trash now
    When you only have connected to your wlan and close the setup you can use the dashbutton to any "action" when sniff or filter the mac of the dashbutton.

    Big thanks for your replay. I hope you can help me to integrated the "dash" button for the sonoff action.
     
  5. Maverickcdn

    Maverickcdn Regular Contributor

    Joined:
    Mar 14, 2018
    Messages:
    141
    Not I at the moment. Maybe @ColinTaylor or another site guru might have an idea.

    If I understand right, when you press the button is when the 'Dashbutton' connects to the router, then disconnects after X secs Im guessing, and you are trying to execute a script when then Dashbutton connects?
     
    Vexira likes this.
  6. Maverickcdn

    Maverickcdn Regular Contributor

    Joined:
    Mar 14, 2018
    Messages:
    141
    If my above post is a correct assumption you can read though this thread https://www.snbforums.com/threads/creating-network-services-filter-script-can-this-be-done.61516/ and the linked threads in that to see about using the arp table to see when a device connects. Or google search
    There may be a way to edit the dhcp-script file called in the /etc/dnsmasq.conf but likely not otherwise Id think there'd be a thread around about it
     
    Vexira likes this.
  7. Martineau

    Martineau Part of the Furniture

    Joined:
    Jul 8, 2012
    Messages:
    3,355
    Location:
    UK
    Many use 'dnsmasq.postconf' to plug-in their custom script:

    e.g. this is mine
    Code:
    # v384.9 (Feb-2019) ASUS now uses dnsmasq directive:
    #    dhcp-script=/sbin/dhcpc_lease
    if [ $FIRMWARE -ge 38409 ];then
        pc_replace "dhcp-script=/sbin/dhcpc_lease" "dhcp-script=/jffs/scripts/DHCP_LeaseTracker.sh   # Request my dhcpc_lease script" $CONFIG
    fi
    then simply call '/sbin/dhcpc_lease' at the end of the custom script.
     
    Last edited: Apr 7, 2020
    Maverickcdn likes this.
  8. Martineau

    Martineau Part of the Furniture

    Joined:
    Jul 8, 2012
    Messages:
    3,355
    Location:
    UK
    Remove the following line from 'dnsmasq.conf.add'
    Code:
    dhcp-script=/jffs/a/post-lease.sh
    then create

    /jffs/scripts/dnsmasq.postconf
    Code:
    pc_replace "dhcp-script=/sbin/dhcpc_lease" "dhcp-script=/jffs/scripts/post-lease.sh   # Request my dhcpc_lease script" $CONFIG
    then add the call to the ASUS utility '/sbin/dhcpc_lease' to the end of your custom script

    /jffs/scripts/post-lease.sh
    Code:
    #!/bin/sh
    
    NowLeasedMac=$2
    
    if [ “$NowLeasedMac” == “10:B3:32:42:55:62” ]; then
       #Do what you want here when dashbutton pressed
       #e.g. I switch on-off my squeezebox player.
       wget http://10.10.1.204/cm?user=demo&password=demo&cmnd=Power Off
       echo “Caught !”
    fi
    
    /sbin/dhcpc_lease [email protected]
     
    Last edited: Apr 7, 2020
    Cam, dev_null and JGrana like this.
  9. StefanP

    StefanP New Around Here

    Joined:
    Apr 6, 2020
    Messages:
    8
    Thanks for your posts but
    @Martineau:

    Apr 20 17:05:02 dnsmasq-dhcp[330]: DHCPREQUEST(br0) 10.10.10.77 aL:58:bE:62:3C:L0
    Apr 20 17:05:02 dnsmasq-script[330]: connect error: No such file or directory
    Apr 20 17:05:02 dnsmasq-script[330]: [SEND_AMAS_NODE_EVENT:(4684)] ERROR connecting:No such file or directory.

    Asus-Merlin Router Version: ASUSWRT-Merlin RT-AC88U 384.16_1-geda9010451
     
  10. Martineau

    Martineau Part of the Furniture

    Joined:
    Jul 8, 2012
    Messages:
    3,355
    Location:
    UK
    Thanks for reporting this, but please search the forum, first reported 4 months ago.
     
    Last edited: Apr 9, 2020
  11. StefanP

    StefanP New Around Here

    Joined:
    Apr 6, 2020
    Messages:
    8
    Sorry to you, but i found only topics with the same probem but no with the fix and in beta versions but nothing answers to this problem :(

    The search give me no more related and fixed tipps.

    It's not only the dash button on every wlan client this message is reapeating it in the logfile.
    Can you give me a tipp or link to fix it - i found it not :(
     
  12. Maverickcdn

    Maverickcdn Regular Contributor

    Joined:
    Mar 14, 2018
    Messages:
    141