A Home Assistant custom integration that creates proxy entities for controlling lights through an override system. This integration allows you to maintain both a default light state and an override state, switching between them with a simple toggle.
- Overview
- Use Cases
- Installation
- Configuration
- How It Works
- Entities Created
- Usage Examples
- Troubleshooting
Man in the Middle Light creates a proxy layer between your automations and physical lights, giving you the ability to temporarily override the default behavior without disrupting your existing automations.
When you set up this integration for a light, it creates:
- A Proxy Light - represents the default/normal state
- An Override Light - represents the temporary override state
- An Overridden Switch - controls which light is active
Point your automations at the Proxy Light for normal operation, and use the Override Light when you want manual control. Toggle the Overridden Switch to switch between them.
The use case this integration was built for, is the following: I have an automation to turn off some lights as soon as my media player starts playing. This is so the room is a bit darker when watching a movie. However, I also use scenes, and that can be problematic. E.g. when a scene is activated during playback: the light turns on again. This Man in the Middle Light solves that. The automation can now just turn the switch to overridden, while the scenes apply to the proxy. As long as the overridden switch is on, the light will stay off. As soon as the switch is turned off again, the light will go back to the state of the currently active scene, even if the scene changed during the movie playback.
- Open HACS in your Home Assistant instance
- Click on "Integrations"
- Click the three dots in the top right corner and select "Custom repositories"
- Add this repository URL:
https://github.com/bartkummel/mitmili - Select "Integration" as the category
- Click "Add"
- Search for "Man in the Middle Light" in HACS
- Click "Download"
- Restart Home Assistant
- Copy the
custom_components/mitmilidirectory to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
- Go to Settings → Devices & Services
- Click Add Integration
- Search for "Man in the Middle Light"
- Select the source light entity you want to proxy 5Click Submit
You can modify the source light entity later through the integration's options.
The integration creates a proxy layer with three entities:
flowchart TD
A[Your Automations/Scenes] --> B{Overridden Switch<br/>OFF/ON}
B -->|OFF| C[Proxy Light<br/>Default]
B -->|ON| D[Override Light<br/>Manual]
C --> E[Physical Light]
D --> E
style A fill:#000000,color:#fff,stroke:#1ABCF2,stroke-width:2px
style B fill:#1ABCF2,color:#fff,stroke:#fff,stroke-width:2px
style C fill:#1ABCF2,color:#fff,stroke:#fff,stroke-width:2px
style D fill:#1ABCF2,color:#fff,stroke:#fff,stroke-width:2px
style E fill:#1ABCF2,color:#fff,stroke:#fff,stroke-width:2px
- When Overridden Switch is OFF: Changes to the Proxy Light control the physical light
- When Overridden Switch is ON: Changes to the Override Light control the physical light
- Both lights maintain their individual states, so switching back and forth applies whichever light's state is active
For each configured integration, three entities are created:
The default light entity. Point your automations and scenes at this entity. When the overridden switch is off, changes to this entity control the physical light.
Supported Features: Inherits all capabilities from the source light (brightness, color, color temperature, effects, etc.)
The manual override entity. Use this in your dashboards or manual controls. When the overridden switch is on, changes to this entity control the physical light. If you just want the light to be off when overridden, you can leave this as is and not add it to any dashboard.
Supported Features: Same as the proxy light
Controls which light is active:
- OFF: Proxy Light is active (default/automated mode)
- ON: Override Light is active (manual/override mode)
This example shows the main use case: preventing scenes from changing lights during movie playback.
Scene (controls the Proxy Light):
scene:
- name: "Evening"
entities:
light.living_room_proxy:
state: on
brightness: 200
color_temp: 370
- name: "Night"
entities:
light.living_room_proxy:
state: on
brightness: 50
color_temp: 454Automation (enables override during playback):
automation:
- alias: "Lights Off When Playing"
trigger:
- platform: state
entity_id: media_player.living_room_tv
to: "playing"
action:
- service: switch.turn_on
target:
entity_id: switch.living_room_overridden
- alias: "Lights Resume After Playing"
trigger:
- platform: state
entity_id: media_player.living_room_tv
from: "playing"
action:
- service: switch.turn_off
target:
entity_id: switch.living_room_overriddenHow it works:
- Your scenes control the
light.living_room_proxyentity - When the media player starts playing, the automation turns on the
switch.living_room_overriddenand turns off thelight.living_room_override - While the switch is on, any scene changes only affect the proxy light - the physical light stays off
- When playback stops, the automation turns off the switch, and the physical light immediately returns to whatever state the proxy light is in (which reflects the currently active scene)
If you see a warning like "Source light entity 'light.xxx' not found yet" in your logs:
- This is normal if the source light loads after this integration
- The proxy entities will appear as unavailable until the source light is ready
- No action needed - they'll become available automatically
Issues and pull requests are welcome on the GitHub repository.
This integration is provided as-is under the BSD Zero Clause License.
Developed by @bartkummel
If you find this integration useful, consider starring the repository or contributing to its development.