Poweroff Recalbox remotely
-
Hi.
I just setup a RPI4 with Recalbox on USB SSD drive.
Everything works really well.
I'm now setting up a sort of "parental control" in home assistant.
I can schedule power hours to the RPI by using a zigbee powerplug, I can monitor when Recalbox is online by using a ping binary sensor thta check when the host is responding, how long it is on and I can set a time limit.
At the moment when the time limit is finished, a google speaker tells my doughter that's almost time to shutdown, ad after few minutes it say that NOW it must be shut down.
I'm trying to replace the last message with a command that powers off correctly the Recalbox machine. Simply switching off the powerplug is not what I want and will probably corrupt recalbox.
I've been able to poweroff recalbox manually by connecting to it in SSH, but it need password so I can't automate the command in home assistant. I've read about creating keys to disable password access, but I'm not good in linux and I didn't succeed.
I saw that the web interface has a poweroff button.
So I think that probably I can call the same command from home assistant, but I don't know how. Is there a REST command that can do that?
Thanks. -
I hope you have already resolved your issue and I am including it here for other users.
you can use Chrome's Developer tool to check the Post command and this example below is what I'm currently using to control Recalbox through Homeassistant
These commands are for Recalbox 9.2 New Web ui
###############################################
rest_command:
emulationstation_reiniciar:
url: http://172.16.8.6/api/system/frontend/restart
method: POST
headers:
accept: "application/json, text/html"
user-agent: 'Mozilla/5.0 {{ useragent }}'
payload: '{}'
content_type: 'application/json; cha**et=utf-8'
verify_ssl: falseemulationstation_parar:
url: http://172.16.8.6/api/system/frontend/stop
method: POST
headers:
accept: "application/json, text/html"
user-agent: 'Mozilla/5.0 {{ useragent }}'
payload: '{}'
content_type: 'application/json; cha**et=utf-8'
verify_ssl: falseemulationstation_iniciar:
url: http://172.16.8.6/api/system/frontend/start
method: POST
headers:
accept: "application/json, text/html"
user-agent: 'Mozilla/5.0 {{ useragent }}'
payload: '{}'
content_type: 'application/json; cha**et=utf-8'
verify_ssl: falserecalbox_reiniciar:
url: http://172.16.8.6/api/system/reboot
method: POST
headers:
accept: "application/json, text/html"
user-agent: 'Mozilla/5.0 {{ useragent }}'
payload: '{}'
content_type: 'application/json; cha**et=utf-8'
verify_ssl: false