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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yet another support for commands 2 #77

Merged
merged 17 commits into from
Feb 24, 2023
Merged

Yet another support for commands 2 #77

merged 17 commits into from
Feb 24, 2023

Conversation

hobbypunk90
Copy link
Contributor

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:
image

miguel and others added 16 commits January 8, 2021 15:46
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.
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
@ironsheep
Copy link
Owner

Interesting I'll take a look!

@ironsheep
Copy link
Owner

ironsheep commented Feb 23, 2023

@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.

@ironsheep
Copy link
Owner

Also, with this 2nd pull request... should we just close the first with no action against it? (does this replace that?)

@ironsheep ironsheep self-assigned this Feb 23, 2023
@ironsheep ironsheep added the enhancement New feature or request label Feb 23, 2023
@ironsheep ironsheep merged commit 7987c0f into ironsheep:master Feb 24, 2023
@hobbypunk90
Copy link
Contributor Author

hey @ironsheep,

thanks, i havn't read the notification yesterday 馃檲 馃槄

@ironsheep
Copy link
Owner

ironsheep commented Feb 26, 2023

@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

@ironsheep
Copy link
Owner

Changes committed and now avail. in v1.8.0 and later.

@hobbypunk90
Copy link
Contributor Author

@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 馃憤 馃槂

@ironsheep
Copy link
Owner

@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?

@hobbypunk90
Copy link
Contributor Author

ahhh, i unterstand 馃榿 its realy simple:

service: button.press
target:
  entity_id: button.rpi_command_<sensor_name>_reboot

but i think a link to https://www.home-assistant.io/integrations/button/ should be enough, what do you think?

@ironsheep
Copy link
Owner

I agree but one more thing. Do you have restart service working? I'd like to see an example of that as well.

  • Stephen

@ironsheep
Copy link
Owner

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.

@hobbypunk90
Copy link
Contributor Author

hobbypunk90 commented Feb 28, 2023

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 馃

@ironsheep
Copy link
Owner

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!

@hobbypunk90
Copy link
Contributor Author

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 馃檪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants