这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rossdargan
Copy link
Contributor

Really this should go into a different branch, especially if you have set up automatic builds for docker. Github won't let me do that though. Feel free to not accept this until I've done more work on it, but it could be a few days and I think this is an awesome feature to have :)

The substring(8) needs testing. The command I was sending resulted in this, but I haven't test if other commands prepend the odd unicode also.

@philhawthorne philhawthorne changed the base branch from master to dev January 20, 2018 22:48
@philhawthorne
Copy link
Owner

Awesome!

I've created a dev branch so the automated build doesn't kick off. The dev branch will build onto docker hub with the tag edge incase people want to use it, before it is released.

What commands are you pushing through? Also do you have a cURL example? I'll setup some tests here before I start making changes.

@rossdargan
Copy link
Contributor Author

The command I was using was:

curl --request POST \
--url http://127.0.0.1:8126/container/alarm-mode \
--header 'content-type: application/octet-stream' \
--data '{"cmd": "./bin/get-mode.pl"}'

But something as simple as "ls" should work too.

@philhawthorne philhawthorne merged commit b22151a into philhawthorne:dev Jan 22, 2018
@philhawthorne
Copy link
Owner

@rossdargan

I've made some tweaks to your feature on the dev branch. I've moved the exec function to its own URL, and allowed the user to specify commands that have several parts (like ls -a).

You can checkout the dev branch, or do a docker pull on the edge tag.

Please test it out, and if it works for your needs I'll release it to master.

For reference, here's a sample call

curl --request POST \
--url http://127.0.0.1:8126/container/grafana/exec \
--header 'content-type: application/octet-stream' \
--data '{"command": "ls -a"}'

Thanks again!

@rossdargan
Copy link
Contributor Author

Working great 👍

@rossdargan
Copy link
Contributor Author

FYI this is how you use it as a rest sensor :)

https://github.com/rossdargan/hass-config/blob/master/configuration/packages/alarm.yaml#L37

@philhawthorne
Copy link
Owner

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants