Any ideas on how a button press could lock your desktop


#1

1) Give a description of the problem
This is just a wild idea I had. My SOP is to put my desktop into locked mode (Windows L) and the turn off my desk light when I leave my desk. It would be amusing to be able to do it all in one action. So, my thought is, is there any way to have a button press (which currently toggles the state of my smart bulb on my desk) also send the PC a command to lock itself?

2) What is the expected behaviour?
Trigger: Button 1 is pressed
Result: PC receives lock command

3) What is happening/not happening?
I’m not sure how to pursue sending a command to the desktop via GET/PUT maybe?

**4) Post a Green Snapshot of the piston![image|45x37]
N/A

5) Attach logs after turning logging level to Full
N/A


#2

Look up Event Ghost post by @wcmore


#3

#4

Lovely (not). I installed EventGhost and set up the webserver add-on. I didn’t, however set up the Lock sequence as I just wanted to test communication first.
Then I didn’t quite install Send-Events-to-Event-Ghost. I didn’t seem to be a part of an repository so I just copied the code and installed it from the code, then published it. It shows up in the IDE, but doesn’t appear in the Automations list in the SmartThings app. I tried using it in the simulator. Here’s where things went weird. The current action of my desk button is to toggle on/off the desk light. I use the Smart Lighting App to do that. It’s worked just fine up to now. When I tried it with the simulator running, it suddenly started to toggle three times for each push. (Light is off, push button, light turns on-off-on. Push button, light turns off-on-off.)
I uninstalled it from the simulator. The behavior persists. I uninstalled Send-Events-to-Event-Ghost. The behavior persists. I even uninstalled EventGhost. I still get the triple-toggle.
Any ideas?


#5

If you can stall 24 hours, I should be able to help with this tomorrow.

Personally, I do not use the plugin. I use webCoRE to send a web request directly to my PC
(static IP:port/?arguments)…
temp
and for return trips, I use EventGhost to execute a piston’s URL (with arguments at the end of the URL)
temp

Without the plugin, this means that SmartThings cannot directly see my PC, and EventGhost can not directly see my devices… but I can make triggers in both programs to communicate with the other, so everything is still possible with a bit of coding.


#6

“I do not use the plugin. I use webCoRE to send a web request directly to my PC
(static IP:port/?arguments)”
That sounds more like what I wanted to do anyway. (I’d already twigged on executing pistons using the URL, but thanks for that as well.)
The triple-toggle is annoying, but doesn’t break anything so 24 hours won’t hurt.


#7

Update: I’ve (at least as far as I can see, completely uninstalled Send-Events-to-Event-Ghost. I’m going to use WCmore’s technique instead.
However, the triple-toggle still happens. I was using the Smart Lighting App to use the my Desk Button to trigger the Desk Light. I deleted that automation and instead used the Pressed Action within SmartThings itself. I still get a triple-toggle when I use the button. I should note that when I tap the Desk Light icon in the SmartThings App or the Desk Light tile I have set up in ActionTiles I just get a single toggle.
The log clearly shows the Desk Light getting an On-Off-On (or the converse) but I can’t see where it’s coming from.


#8

Just to clarify… I was offering to help with your OP (and setting up EventGhost)

The triple toggle is another matter. You did not share enough information for me to comment on that issue.


#9

WCmore: No problem. We were on the same page on that.
As it turns out, I figured out how to set up EventGhost with enough time to realize that I probably don’t want to do it that way after all :slight_smile: What I’m thinking is that, instead of using a button to toggle the light and the lock mode on the computer, I can instead do the reverse and use the lock mode on the computer to set the state of the light. That will use the technique of having EventGhost use the URL for a piston which you explained in the other thread. So, I’m good there. No further help needed… I think… I’ll let you know if it turns out otherwise :slight_smile:
On the triple-toggle front, I went ahead and deleted my button and then added it again. That “solves” the problem as far as the triple-toggle behavior is concerned although I think it’s just masking the issue by assigning the device a new ID which isn’t connected in that invisible way that’s messing things up. I’ll probably have to run this through Samsung Help to see if they can find any undead vestiges of my experiment. No further help needed on that from this community for certain.


#10

Excellent!!

I have mine setup whenever my PC goes into screensaver mode, it executes a piston that dims my office lights. Later, when I wake up the PC, the lights return to “normal” level… (which is different based on who is home, time of day, etc)

No button required. Just lock or unlock the PC to trigger.

It looks pretty snazzy when the PC & room dim/brighten at
nearly the same instant. (actually about 1 second apart) :sunglasses:


Edit:
An advanced version of this could have webCoRE alert you if you have been at the PC for too long (time for a break), or text you if someone is using your PC while you are not home. Once the two ecosystems can communicate with each other, the sky’s the limit!

For example, I added a 12 inch “Cyclone” fan to my den (aimed right at the PC), so when the PC is on for awhile, that fan kicks on. (to help with circulation)


#11

It’s all working for me. I’m finding tying the light to the lock mode is a much more elegant solution than I had originally thought of. I think I got started down that track and had to hit a few bumps before I thought about changing directions. The other neat thing about this is that if I pair my phone to the desktop, it will lock my screen automatically when I leave the area and that will cause the Desk Light to shut off too. #ImGeekingOutHere
I like the “time of day - brightness” idea. My Desk Light is dimmable and I do find less illumination during the wee hours of the night is helpful to me and to the others who might otherwise be kept awake.