-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add ability to call command-line scripts (vs. HTTP requests) #45
Comments
The change is pretty simple, but it's already changes the core purpose of this plugin. |
I think it expands a lot of functionality, so I'm open for it. The only thing is how to handle the configuration. I was thinking maybe the user could use const exec = require('child_process').exec;
const url = require('url');
...
exec(url, (err, stdout, stderr) => {
if (err) {
//some err occurred
} else {
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
} |
Are there already any updates on changing/ adding command-line features to this plugin? |
@hauni97 I just pushed some changes in a beta version, would appreciate if you can test them. e.g., It works as follows:
This is a bit of a patch for now, I'm working on additional changes which will be part of a future version, but don't want to break anything for now. |
Thanks. I just tried using it, and it gives me the error no response in HK; the blinds are not moving. This is the Homebridge log after using it and filling in, up, down, pause + time it takes to upen & close:
[12/27/2020, 17:11:00] [Blinds Command] Name, up, and down commands are required configuration parameters. I inserted the following into the UP, DOWN, PAUSE Command Script:
My python script contains the following (based on MQQT, changes depending on up, down, and pause): import paho.mqtt.client as mqtt
#Copyright
client = mqtt.Client()
client.username_pw_set(username=“username”, password=“password”)
client.connect(“broker”, port, no)
client.publish(“topic”, “command _to_close_blinds");
client.disconnect(); |
Can you send me your full config @hauni97 ? |
Also @hauni97 , please try:
Found a minor issue. |
Sure this is the config of my accessories for this specific plug-in and the test blind: },
"accessories": [
{
"name": "TEST",
"up_url": "file://python /var/lib/homebridge/Blinds_UP.py",
"motion_up_time": 25000,
"down_url": "file//python /var/lib/homebridge/Blinds_DOWN.py",
"motion_down_time": 25000,
"stop_url": "python /var/lib/homebridge/Blinds_Pause.py",
"accessory": "BlindsHTTP"
}
], Please let me know if you require any further info. |
This needs to be: "down_url": "file://python /var/lib/homebridge/Blinds_DOWN.py",
This needs to be: "stop_url": "file://python /var/lib/homebridge/Blinds_Pause.py", |
Btw, please remember to restart homebridge after installing the update and making the config changes. |
Works now without an error, blinds are moving.
When moving down: It stopped at the desired position for a few seconds but then kept moving down to full without doing anything in HK. |
Thanks @hauni97. It could also depend on your set up and how your MQTT<-->blinds interface is working. I would also encourage you to add the |
The plugin with the command line addition works perfectly, just tried it with five different binds. Thanks for adding that feature. |
thanks for testing @hauni97! I'll update the docs and push this out as an official release shortly. |
Btw, @hauni97 would you be willing to publish anonymized versions of your scripts? Could be included in the wiki... I imagine useful for other users. (And, I guess you did not use the position_url feature?) |
Yes, I’m willing to share anonymized scripts with instructions and further info.
Please let me know where to provide them.
No, I haven’t used a position URL.
|
Thanks @hauni97 you can post them here: https://github.com/dxdc/homebridge-blinds/wiki |
Btw, published as a new (official) release, although no code-based changes from the one you have - just documentation. |
Perfect, I’ll add them to the appropriate section in the README.md tomorrow afternoon GMT (
Probably by creating a pull request to the .md.).
|
Thx! I would suggest just writing an entry on the Wiki directly, it's user editable (no PR needed). I don't want to clutter the README unnecessarily. |
@dxdc I tried to edit the wiki, are you sure it is publically editable? When hitting the wiki button it redirects me to the main repo (https://github.com/dxdc/homebridge-blinds), no button to edit the wiki is shown as in other repositories. |
@hauni97 can you try again? I didn't have an initial page set up, not sure if that was an issue. |
@dxdc Yes, there is a Wiki now, but no rights to edit it. |
Maybe this helps: https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/changing-access-permissions-for-wikis "Collaborators can edit a public repository's wiki by default, but you can allow anyone with a GitHub account to edit your wiki." |
Sorry... try again @hauni97 |
@dxdc no worries it works now. I Will work on the wiki in the coming days and add useful content. |
See: https://github.com/hjdhjd/homebridge-blinds-cmd
The text was updated successfully, but these errors were encountered: