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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial on how to set this up with Home Assistant? #94

Closed
inobrevi opened this issue Feb 11, 2024 · 6 comments · Fixed by #105
Closed

Tutorial on how to set this up with Home Assistant? #94

inobrevi opened this issue Feb 11, 2024 · 6 comments · Fixed by #105
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@inobrevi
Copy link

How can I set this up with Home Assistant? (I have it as a docker container or RPI)

Goal: Control Shutdown/Hibernation of Windows 10 PC.

@infeeeee
Copy link
Collaborator

  1. You need an MQTT broker. I use eclipse-mosquitto in docker, but anything should work, you can find the official list of brokers here: https://mqtt.org/software/
  2. Enable the MQTT integration in HA, and connect to your broker: https://www.home-assistant.io/integrations/mqtt
  3. Install and setup IoTuring, in the configurator menu add the HomeAssistant Warehouse, connect to the same broker. Add the Power Entity to shutdown your computer. Hibernation is not supported yet, only sleep.
  4. When you start IoTuring, your computer will show up as a new MQTT device in HA automagically

@infeeeee infeeeee added documentation Improvements or additions to documentation question Further information is requested labels Feb 11, 2024
@infeeeee
Copy link
Collaborator

You can create a hibernation button with a Terminal entity. Just select Button, and add this command:

%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate

Source: https://superuser.com/questions/463646/is-there-a-command-line-tool-to-put-windows-8-to-sleep/463652#463652

@inobrevi
Copy link
Author

Hi!

Thank you for the info.

I moved to Home Assistant OS to avoid integration issues.
Everything works, but now I have to figure it out, how to make it work in background, without running it in command window.

@infeeeee
Copy link
Collaborator

If you use HAOS, you can install the Mosquitto broker addon: https://github.com/home-assistant/addons/blob/master/mosquitto/DOCS.md

For running in the background on windows, I recommend to run IoTuring as a service with NSSM: https://nssm.cc

@inobrevi
Copy link
Author

I figured out first part.

I will let you know if I manage to make it a service :)

@inobrevi
Copy link
Author

Hello!

I figured it out, but better and easier.

Basically, after configuring IoTuring, you can create a IoTuring.bat file:

@echo off
python -m IoTuring

And then run it from IoTuring_hidden.vbs script, which would run it without showing console window:

CreateObject("Wscript.Shell").Run "IoTuring.bat",0,True

Save both files in the same folder, run IoTuring_hidden.vbs and it just works.
You can also add this .vbs script to autorun, but I didn't test that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants