[APP][Pro] Desktop Device

Why did you move /s to working directory? This is an argument to shutdown so command should be shutdown /s. Also this only works if you are on Windows. Not sure what OS you are on.

Hi, nice app. Are you also planning to create the option that the Desktop Device app in Windows can mimic a keyboard button? So I can create a ā€˜thenā€™ flow card where this app will ā€˜pressā€™ the Escape key to close an application?

Are you on windows? If so you could do this:

Seems you said you are on Windows missed that so the above command should do what you want.

Thanks a lot! I have not managed to get it working yet, and I have copied every detail in my flow. But I will try to play with this idea.

Thanks for the app!

One questionā€¦ Can you explain what I can do with the display (values) option? Can you select your primair display with this by example? I am using a multi monitor setup so that will be very niceā€¦ But I have no idea yet how to use it.

And, it will be nice to have an option for a WHEN and AND card like; ā€œdesktop is connectedā€. Now I need a serperate app like netscan or the smart presence app for thisā€¦

You can create displays and they will be added to [APP][Pro] Desktop Device. You can update these displays with Flows.

The problem with the connected cards is that those cards wont run because Homey does not run cards for non available devices. So I would somehow have to override the standard discovery logic that marks a device available/unavailable. Might look into it at some point.

1 Like

Maybe you already solved this, but if notā€¦ Hereā€™s the solution:

Run command: shutdown /s
Working directory: c:\windows\system32
Timeout: 0
ID: doesnā€™t matter

@Jero

Hi,

I am unable to execute a CMD command from the ā€œrun commandā€ card. What does work is putting al CMD commands in a batchfile and run that batchfile with the ā€œrun commandā€ card.

I tried using cmd.exe /K to keep the CMD window open, but that didnā€™t work. Even only running cmd.exe doesnā€™t open the command prompt. Tried notepad.exe and that did work.

Can you help?

What Iā€™m trying to do is set a variable in the Windows machine. And with a separate command I send the variable to Homey with a Curl command. The Curl command works and gets send.
This is the command I want to run:

cmd.exe /k setx Homey_BatteryConnectionStatus Yes

Have you tried it without ā€˜cmd.exe /kā€™ ?

So I tried your suggestion and that works!

One thing I stumble upon is the following and maybe you have an answer to this also.

From Homey with the Desktop Device-app I execute a Windows command on my laptop:

for /f %a in (ā€˜WMIC Path Win32_Battery Get estimatedchargeremaining^|findstr [0-9]ā€™) DO SETX BatteryLifeRemaining %a

With this command Windows reads the estimated charge remaining in my battery and stores that value as an environment variable.

Then from Homey with the Destop Device-app I execute a CURL command to send the new variable as JSON to Homey, so Homey can extract the Battery value. And from this point I get stuck. The CURL command doesnā€™t send the variable value, but only %BatteryLifeRemaining%. Windows does that when no variable with that name has been found. When I hard close the Desktop Device-app on my laptop and restart the app, after that the last known stored value gets send. So the last time I excecuted the SETX command and the value was 10, then Homey receives 10.

But when I execute the command to read the estimated charge remaining and set it as a variable again and the charge is now 5. When I send a new Curl command, the value remains 10 and not 5. If I hard close the software and reload it and then send the Curl command, the right value 5 gets send.

So everytime I reload the program it looks like itā€™s reading the variables as in that moment.

A long story, I Know. Any suggestion would be welcome.

Aaaah it has something to do with cmd commands not getting executed as admin.

Maybe you can start the desktop app with admin privileges?

Hi @Jero

Thatā€™s a great idea! Thanks. Will try.

Hi Jeroen,
I have installed the desktop app on my PC and the Homey app on my Homey Pro. The desktop app shows itā€™s connected to my Homey.

In the desktop app I have added a button and named it ā€˜Muisknopā€™ but now iā€™m stuck on what to do next.

My goal is to let the Homey check if my PC is in use by periodically checking if the mouse button is being pressed. If the PC is not being used for some time or if itā€™s not reachable because itā€™s switched off I want to start a flow.

Is this possible and how do I do this?

This is not possible because there are no hooks into the OS or something. Its just buttons to send an event to Homey and Homey can send events backs. No wachting of things occurs at this moment.

OK, thanks!

Hi Jero,

Just a follow-up. Unfortunately it didnā€™t work. Perhaps it has something to with the Windows version, being Windows 10 Home and the fact Iā€™m sending commands that are executed in CMD. In Home version thereā€™s no way to automatically open every CMD session as admin.

I could use a program such as Elevate, but went for another route. I created a task in Task Scheduler which can run with the highest privileges and that way it runs a batch script that sets the variables. And another task that sends the variables via Curl.

I believe itā€™s not a limitation of your program, but rather a limitation of the Windows version.

@Henry_van_der_Wielen

For the part where you want Homey to check if your system is switched off, you can use the Homey Presence-app. It checks at a set interval if your system is reachable by IP-address.

As for the check to see if your system is being used, you could set your system to log off the user after a certain amount of time. When logging of (depending on your Windows version) let Windows run a batch script that sends a webhook to Homey to let Homey know the system is on but not in use. And do the same when you login.

Now, for logging in you can use the Task Scheduler to run a script that sends the webhook everytime you login. But Task Scheduler doesnā€™t provide an option to set a task to run when logging of. With the right Windows version you can use the Group Policy Editor (gpedit.msc). From there you can set a script to run when logging of.

I think Iā€™ve asked before, but I havenā€™t gotten any working solutions (and the noe Iā€™ve found that can be run from command prompt need elevation) - anyone got a good way to put the computer to sleep? I found something called ā€œSleepOnLanā€, but that didnā€™t work at allā€¦

Iā€™ve just created a new test release which contains a new feature.

App Version

This is on the test release channel.

https://homey.app/nl-nl/app/nl.jwienk.desktop-device/Desktop-Device/test/

Desktop App Version

Made it a draft release so it wonā€™t show up for non test users. Currently no mac version (it wont build for some reason).

https://github.com/jeroenwienk/homey-desktop-device/releases/tag/untagged-ea5bf5e360dd3a430c67

Desktop Commander Window

The feature is a window that can be brought up with ctrl (command on mac) alt k. The key can be configured in the desktop app settings.

It is ment to be used in combination with a when Flow card that creates the commands.

Inputs can be send to the command by selecting the command and activating input mode with !. Any value after ! is treated as the value for the tokens in the Flow card. So in my example above the trigger card will receive 0.1 as a number token called arguments. A text token will also be passed with the same value. You can of course also create command that have no arguments and just do something in the Flow.

Iā€™m currently looking for some testers since itā€™s been a while since I released something for this app and would love to hear your thoughts about this feature.

The window eventually is ment to be transparent but for debugging itā€™s currently easier this way.

1 Like