Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One button that can toggle between actions #69

Open
chofo1979 opened this issue Aug 5, 2018 · 3 comments
Open

One button that can toggle between actions #69

chofo1979 opened this issue Aug 5, 2018 · 3 comments
Assignees
Milestone

Comments

@chofo1979
Copy link

chofo1979 commented Aug 5, 2018

What is the purpose of your issue?

Feature request (request for a new functionality)

Hello!
Is there a way to make something like this: https://github.com/ServError/dasher-toggle

My problem is that I'm using a pogoplug and it did not went well with node.js because of its ARM processor architecture. So I found yours and python is working just fine but it would be awesome to have the toggle functionality so you can toggle between states (on, 50% dim, off... for lights on a wink hub using ifttt for example)

Sadly I cannot code, I just kind of understand it.

If it is of any help.. I found this while browsing for the solution: https://raspberrypi.stackexchange.com/questions/85505/toggle-state-to-trigger-a-function-with-a-button-in-python-loops-on-and-off-an

Thanks for this program!

@Nekmo
Copy link
Owner

Nekmo commented Aug 5, 2018

Hello,

It could be added as a new feature but with the current config it is a bit complicated. I am making a Amazon-dash 2.0 version with a new configuration. I could add this feature in the new release.

However, there are still many months left for Amazon-dash 2.0. I can try to help you by doing a bash script.

Regards.

@chofo1979
Copy link
Author

Hello,
Thanks for the response. It would be great to have it on version 2.0 then. I can test if/when you want me to.

So you can do it with a script? Thanks for offering to help. Where do we start? I have never made a script before. Will read a bit about it and then come back so that you can help me.

Thanks again!

@Nekmo
Copy link
Owner

Nekmo commented Aug 8, 2018

try this script:

#!/usr/bin/env bash

FILE=~/.dash_on

if [ -f $FILE ]; then
   echo "Action is ON"
   amazon-dash test-device 00:11:22:33:44:55 --config /etc/amazon-dash.yml
   rm $FILE
else
   echo "Action is OFF."
   amazon-dash test-device 00:11:22:33:44:66 --config /etc/amazon-dash.yml
   touch $FILE
fi

Save the file as /usr/local/bin/toggle.sh. After grant perms:

chmod +x /usr/local/bin/toggle.sh

And add this script to Amazon-dash config:

# amazon-dash.yml
# ---------------
settings:
  delay: 10
devices:
  0C:47:C9:98:4A:12:
    name: Hero
    user: nekmo
    cmd: /usr/local/bin/toggle.sh
  00:11:22:33:44:55:  # Fake mac
    name: Pompadour1
    ifttt: cdxxx-_gEJ3wdU04yyyzzz
    event: action_1
  00:11:22:33:44:66:  # Fake mac
    name: Pompadour2
    ifttt: cdxxx-_gEJ3wdU04yyyzzz
    event: action_1

Regards

@Nekmo Nekmo added this to the v2.0.0 milestone Aug 20, 2018
@Nekmo Nekmo self-assigned this Aug 20, 2018
@Nekmo Nekmo changed the title One button that can toggle between IFTTT actions One button that can toggle between actions Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@Nekmo @chofo1979 and others