Here’s the scenario I have:
- a Windows PC with IoT service running (so I can send “shutdown” commands to shutdown Windows).
- The windows PC BIOS has been set to automatically turn on the PC when power is supplied
- TP Link power socket is used as the switch to supply power to the PC
Can someone please help me create a switch that does the following:
- turn on = switch.tplink_computer1
- send MQTT Shutdown to IoT service on Computer1 (topic: “iotlink/workgroup/computer1/commands/shutdown”)
- wait 5mins (ample time for Windows to shutdown)
- then turn off = switch.tplink_computer1
Not sure how to do this exactly? Is a template switch the answer?
Thank you in advance
Ok, so chances are you won’t get far with this. The goal is that you learn to do it yourself. So maybe start with making all the entities you need for the automation work from manual switching them from HA. Then when you’ve got all entities working you can split this automation up in little parts (make it easy on yourself). You can create automations in the GUI to start with.
Thanks for your input, but I am struggling with the “automation” part i guess…
I have created input booleans and using NodeRED to send the MQTT packets to the Computer… which shuts it down correctly.
Currently I can manually turn off the input Boolean which will send the MQTT packet and then I have to manually turn off the TP Link (after 5 mins) to kill the power to the computer.
My issue is, I’m struggling to understand how to “automate” this… or put it into 1 switch?
Ok, there are multiple ways. You could do it from node-red all together. If you are familiar with node-red that might be easiest for you. Second you can do it from the automations option in the configurations menu. There is a nice and clean step by step interface to make an automation. That is pretty simple. You could start by creating an automation with the iot input_boolean as a trigger and the TPLink switch as action to turn of with a delay of x minutes.
The last option is to program in yaml but I wouldn’t go there yet if I were you. Templates are not necessary for this automation afaik.
Thanks for your reply @frits1980
Ideally I would like it to be a template switch if possible so then it is just one switch that controls ON and OFF rather than input booleans and a TP Link switch and nodeRED/automation.
This is also because, I need to “group” these switches to turn on and turn off (send MQTT, 5min delay, then turn off TP LINK) multiple computers at the same time…
All good, I managed to use NodeRED and input booleans and then created a Group so I can control all switches and their delays + MQTT
thanks for your input