Virtual Motion Sensor (from PC)

I still run a Hubitat, I know, I know.
One thing it does is receive messages from Windows Powershell and turn it into a virtual Motion sensor.

This is in the wiki of the project.
The PC Virtual Motion Sensor is essentially a Windows PowerShell script that can be configured to run periodically on the PC being monitored, detecting the number of seconds since the last user input was recorded, e.g. mouse movement or keyboard strokes. This reading is compared to a threshold resulting in a status of active or inactive being recorded in a Virtual Motion Sensor device made available through the Hubitat Maker API.

My question is: is it possible to do this with Home Assistant? Not sure where to start. Is there an equivalent API that I can access?

Calling @sburke781 as it’s your git, i just noticed.

1 Like

I’ll see what I can work out. Node RED may also get in the mix.


My very fuzzy head is thinking a binary sensor in HA may be what could be a starting point, without really knowing a lot about integrating with HA. I might dig through the HE → HA integration to see how the updates are sent for various sensors to see what it supports and how the comm’s are handled, particularly for motion sensors. This may provide a more appropriate way to set things up in HA.

looks like you could create a token and hit an api endpoint for this. I am still learning terminology but seems there is a group of “helper” devices that are similar in nature to virtual devices? Combine the two and you have a virtual motion sensor that you can use for automating the lights or whatever else?

Perhaps I am way off here.

Kind of a related question. @sburke781 or anyone else. What is your practice for editing the home assistant yaml files. These were giving me major headaches using a notepad on windows. I have managed a measure of success. Just curious what those of you more familiar with computer languages and coding use for editing.

Seems the recommendation in the visual studio add on for home assistant as it has some helpful stuff specific to home assistant. Given our HA installs are core it makes using addons not so easy. Does anyone have an idea of what the process would be to load one of these addons in podman and make it work?

Would this be the same process as setting up user integrations as has been documented elsewhere? HA has turned out to be a huge rabbit hole, but time consuming in a fun way.

1 Like

This is the reason the code editor was included as an option on core :slight_smile: ( The editor is great for yaml files, but if you prefer notepad etc there are online tools that can also be used to clean up your indenting etc.

Sorry I haven’t been around to help out with the HA questions lately, granny finally passed on, so ive been dealing with all the aftermath of that, working on preparing for the holiday lighting season, and finally setting up a real lxc/vm server to run NAS/NVR/*arr/etc for the house.

It would be the same as user integrations and the existing documentation april/markus did on it is in the docs section, but it would be far easier to use the inbuilt version on core:

So sorry to hear of your loss.

I completely forgot about the Core code editor that was included - I actually installed the config editor from within HA that works fine for .yaml files.

Very sorry for your loss. No need to worry about my silly questions.

I tried firing up the code editor and had no idea what to do with it once there. So perhaps thats a lost cause for now.

@nutcracker what is this config editor you speak of? Everything ive seen was an addon. Hence my questions lol.

From memory, I installed config editor via HACS - didn’t complete all the steps as described here but enough to allow me to access the editor via the menu on left hand side.

Always a good habit to have HA check the configuration file after you’ve made future changes to it from within the editor (via Development Tools menu option and click Check Configuration). If all good, then you know its safe to restart HA.

I’d echo the sentiments of others here in saying, no need to apologise, our home automation takes a distant second place compared to events like that. Time with your family and processing what has happened is more important than our requests.

I don’t mind if we mix topics, but it may be useful for some if the notes about the code editor and other related features are covered in a separate topic, if only for ease of locating the comments.

Nice. This is quick easy and effective for simple stuff. Thank you for pointing it out. Ibhad not stumbled across it yet.

On topic @Mike did you have any lucknsetting this up?

1 Like

Wow, it does sound overly complicated to setup a simple virtual motion sensor in HA… Unless I’m missing something. If someone else can figure that part out I should be able to do the API call easy enough, I expect.

Possibly another path…

1 Like

This topic was automatically closed after 180 days. New replies are no longer allowed.