top | item 25106128

(no title)

casenjo | 5 years ago

> The lights in my office come on when I walk in if it's dark, and when I unlock my computer it shoots a message out over a MQTT broker which my automation takes as "someone is occupying this space now" and leaves them on. When I lock my computer, two minutes later if no motion is sensed it'll turn them off.

What did you do to send the message when the computer locks/unlocks? This is an exact use case I could make use of

discuss

order

andyrew|5 years ago

IOTLink could be used for this: https://iotlink.gitlab.io/

As far as I'm aware it doesn't report locked/unlocked status, but it does report system idle time which you could use for a similar automation.

nucleardog|5 years ago

So, short answer: an MQTT client. On lock/unlock I have a MQTT client called to publish a message to a topic. I think I'm using HiveMQ's mqtt-cli because it was the most immediately obvious option for my OS.

Working out from there:

* I use Windows as the host OS for my desktop. You can use Task Scheduler to set a task to run on lock/unlock. I have jobs set that mute/unmute my audio and call a MQTT client to publish the messages to the broker.

* Those messages are picked up by Node-RED. It's a ladder-logic-ish environment for automation. It has flows that control all the bits of logic based off of all the various data sources including MQTT.

* Node-RED calls Home Assistant, which handles providing a UI as well as actual integration with all the various bits of hardware (light bulbs, z-wave controller, etc)

I quite enjoy this stuff (which is probably half of how I got here), so feel free to ask if you've got follow-up questions.

seized|5 years ago

Indo the same idea but use a ZWave smart plug with power use monitoring with my monitors plugged into that. Watts > some number = I'm working.

Via zWave2MQTT and NodeRed it triggers other logic like throttling RClone uploads.