ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
460 stars 64 forks source link

Yet another support for commands 2 #77

Closed hobbypunk90 closed 1 year ago

hobbypunk90 commented 1 year ago

Sorry, i deleted my fork on github in a little cleanup action :sweat_smile: but i merged now your new master changes :grin:

My changes are based on #27, but adds support for home assistants buttons like this: image

ironsheep commented 1 year ago

Interesting I'll take a look!

ironsheep commented 1 year ago

@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 commented 1 year ago

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

hobbypunk90 commented 1 year ago

hey @ironsheep,

thanks, i havn't read the notification yesterday :see_no_evil: :sweat_smile:

ironsheep commented 1 year ago

@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 commented 1 year ago

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

hobbypunk90 commented 1 year ago

@ironsheep i'm not sure what you mean :sweat_smile: 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 :grin:

i like your doc :+1: :smiley:

ironsheep commented 1 year ago

@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 commented 1 year ago

ahhh, i unterstand :grin: 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 commented 1 year ago

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

ironsheep commented 1 year ago

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 commented 1 year ago

I tried it and it works like a charm :+1:

i had a look at the service restarting stuff. it doesn't work, but i think it never worked on my system :thinking:

ironsheep commented 1 year ago

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 commented 1 year ago

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 🙂