-
-
Notifications
You must be signed in to change notification settings - Fork 61
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yet another support for commands 2 #77
Conversation
Why: Quick way to reboot a RPi or to restart services. The alternative is to SSH to the RPi and execute sudo reboot. Not always handy. How does it work: The daemon now subscribes to an 'actuator' topic similar to the 'sensor' topic previously supported for publishing. Only commands registered can be executed (for now: shutdown, reboot, service-restart). This feature can be enabled/disabled from the config.ini file. Note: some of this commands require sudo privileges. A workaround is proposed in the README.MD file.
Update from upstream
Use home assistant button feature, add possibility to add every needed command
Spawn commands in background to prevent blocking the reporter
After a reconnect the commands didn't work anymore
Interesting I'll take a look! |
@hobbypunk90 I've had a number of requests for this. Your approach makes sense and lets our users decide if they want to enable it. I might even make it not expose the interface unless the commands are active in the config.ini. |
Also, with this 2nd pull request... should we just close the first with no action against it? (does this replace that?) |
hey @ironsheep, thanks, i havn't read the notification yesterday 馃檲 馃槄 |
@hobbypunk90 would you be willing to show your card configurations? I'm having trouble trying to pass the service name on the button press for restart service (at least that's what I think you are intending?) I do have reboot and shutdown working. Also: what do you think of my doc so far? https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/master/RMTECTRL.md |
Changes committed and now avail. in v1.8.0 and later. |
@ironsheep i'm not sure what you mean 馃槄 i don't use the command buttons on my dashboards, i only trigger them in an automation. with this commands and an rpi i added a scan2email feature to my scanner 馃榿 i like your doc 馃憤 馃槂 |
@hobbypunk90 I'm newer to HA so I'm looking for examples that I'll include in the documentation. Can you provide snippets for how you cause RPi reboot and RPi service restart in your setup? |
ahhh, i unterstand 馃榿 its realy simple:
but i think a link to https://www.home-assistant.io/integrations/button/ should be enough, what do you think? |
I agree but one more thing. Do you have restart service working? I'd like to see an example of that as well.
|
Also, please see if v1.8.1 works for you. I've added more ha advertisement detail so when used on cards the buttons dim if the RPi is not powered on. |
I tried it and it works like a charm 馃憤 i had a look at the service restarting stuff. it doesn't work, but i think it never worked on my system 馃 |
It looks like it was parameterized... I'll make it not and try it. There may be an issue with a "Hey running script, tell the system to restart you" so it may not in the end work... but I'll give it a shot. Maybe we will get lucky... If we don't get it to work I'll just remove that endpoint. But cool idea! |
It is "parameterized" {} will replaced with the action from ha. At this moment it is "PRESS", as soon as HA can send different actions, press, long press, double press, for example, the command will get this action as param 馃檪 |
Sorry, i deleted my fork on github in a little cleanup action 馃槄
but i merged now your new master changes 馃榿
My changes are based on #27, but adds support for home assistants buttons like this: