"WindowsEasy"

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

"WindowsEasy"

#1 Post by martinus » 18 Jan 2024, 14:40

As i have really grown to use the rules engine on my ESP devices and also quickly navigate between ESP units to manage my home even without a central home automation system, i wanted to integrate my Windows Hosts into this 'eco system' as well.
So i've build a PowerShell based prototype to provide a simple webgui and rules engine with a similar approach and look and feel as the ESP nodes. They will communicate through MQTT, but the Windows node will also manage the nodelist updates using UDP messages.

So here is the first working prototype in action:
WindowsEasy.png
WindowsEasy.png (148.41 KiB) Viewed 1190 times
Now i can control the Virtual machines that run on the Hyper-V hosts from a webpage button or from events using MQTT. So in theory an ESP unit could start or stop a Virtual Machine.
I also use another Windows Host to manage my secure email (TLS) and my PushOver messages (HTTPS). Running secure communications is a lot easier from Windows/PowerShell than native ESP and the ESP units just let the Windows Host send the alerts.

Not sure where this will end, but anyway it was fun to learn and build the prototype. I've used PowerShell a lot before, but now its even more easy to run and schedule scripts.

The rules engine will support some basic ESPEasy commands but i can also directly run native PowerShell from the rules engine like this:

Code: Select all

On webPrint do
  webPrint
  webPrint Role: Hyper-V host
  webPrint <br>VM States:
  webPrintcall Get-VM | where {$_.state -ne "Off"} | select name,state | ConvertTo-HTML -head ""
  webPrint <table>
  webPrint <tr><td>DC19<td><a class="button-link" href="/?group=windows&cmd=event suspendVM=DC19">Pause</a>
  webPrint <td><a class="button-link" href="/?group=windows&cmd=event resumeVM=DC19">Resume</a>
  webPrint <td><a class="button-link" href="/?group=windows&cmd=event startVM=DC19">Start</a>
  webPrint <td><a class="button-link" href="/?group=windows&cmd=event shutdownVM=DC19">Stop</a>
  webPrint <tr><td>SP19<td><a class="button-link" href="/?group=windows&cmd=event suspendVM=SP19">Pause</a>
  webPrint <td><a class="button-link" href="/?group=windows&cmd=event resumeVM=SP19">Resume</a>
  webPrint <td><a class="button-link" href="/?group=windows&cmd=event startVM=SP19">Start</a>
  webPrint <td><a class="button-link" href="/?group=windows&cmd=event shutdownVM=SP19">Stop</a>
Endon

On SuspendVM do
  call suspend-vm -name %eventpayload%
Endon

On ResumeVM do
  call resume-vm -name %eventpayload%
Endon

On StartVM do
  call start-vm -name %eventpayload%
Endon

On ShutdownVM do
  call stop-vm -name %eventpayload%
Endon
For now, i just call it "WindowsEasy" ;)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: "WindowsEasy"

#2 Post by TD-er » 18 Jan 2024, 15:15

What p2p ID did you use, so I can add "Windows" to the ESPEasy code base :)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: "WindowsEasy"

#3 Post by TD-er » 18 Jan 2024, 15:17

Oh and did you notice I have encoded the build date into the "ESPEasy version" as is being sent via the p2p node info?
See: https://github.com/letscontrolit/ESPEas ... py#L13-L17

User avatar
Ath
Normal user
Posts: 3520
Joined: 10 Jun 2018, 12:06
Location: NL

Re: "WindowsEasy"

#4 Post by Ath » 18 Jan 2024, 17:32

:geek:
/Ton (PayPal.me)

martinus
Normal user
Posts: 129
Joined: 15 Feb 2020, 16:57

Re: "WindowsEasy"

#5 Post by martinus » 04 Feb 2024, 14:19

TD-er wrote: 18 Jan 2024, 15:15 What p2p ID did you use, so I can add "Windows" to the ESPEasy code base :)
I'm using 255 currently, just not to interfere for sure. Not that likely that any other will find a usecase for "WindowsEasy" i guess...

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests