Stories

The projector you must not unplug

home-assistant-config · safety interlocks · · updated

My projector's lamp needs its fans after you switch it off, and cutting power while it's hot shortens the lamp's life. The projector sits on a smart plug that measures current, so Home Assistant can tell "lamp on" from "fans only" from "actually off".

The first version cut the power at the end of every session, carefully: wait 90 seconds, then check the current every 10 seconds, and open the relay only after two readings in a row at or below 0.06 A. If the sensor stopped answering, the power stayed on. It protected the lamp, but it had a cost. With the power cut, the remote's power button could wake the TV box and the receiver, but not the projector.

So now the projector never loses power when a session ends. Home Assistant puts it to sleep over HDMI-CEC, the same way the TV box would, and the projector's own fans cool the lamp. Standby draws about 0.01 A, and the power button brings the whole theater back.

Leaving the power on opened a new gap: anything that wakes the TV box, like an update, can light the lamp in an empty room. A guard watches for that. If the lamp has been lit for 2 minutes and nobody's using the theater, it sends a sleep command through the TV box, checks again a minute later, and sends me a notification. It never cuts the power. Putting a projector to sleep is always safe; pulling its plug isn't.

Music is the one time the power still gets cut. Music doesn't need the projector, so if the lamp is already cold, Home Assistant cuts the power before the receiver wakes, and HDMI-CEC can't light the lamp just to play a song.

The safety code lives in its own file now, too. Home Assistant reloads a script file as soon as it's saved and stops that file's running tasks, so an edit to the theater code used to cancel a cooldown in progress. With the interlocks kept apart, routine edits can't touch them.

It's one of five hardware interlocks in the repo, all covered by tests. Watch it in the simulator.