"Simple idea. Powerful automation. Total control."
This project automates your room light based on your phone screen state (ON/OFF). When you turn your phone screen ON, the light turns ON automatically β and when the screen turns OFF, the light turns OFF too.
No cloud. No internet required. 100% local, fast, and reliable.
Phone Screen ON / OFF
β
βΌ
[Tasker]
Detects Screen Event
β
βΌ
HTTP POST Request
POST /api/services/...
β
βΌ
[Home Assistant]
REST API (Local Network)
β
βΌ
[Shelly Relay]
Receives ON/OFF Command
β
βΌ
π‘ Light ON / OFF
All communication happens over local Wi-Fi β no cloud dependency.
| Component | Role |
|---|---|
| π± Tasker | Detects phone screen events & sends HTTP POST |
| π Home Assistant REST API | Receives request & executes service |
| π‘ Shelly Relay | Physical relay that switches the light |
| πΆ Wi-Fi (Local Network) | Communication backbone |
- π Automatic light control based on phone screen state
- π 100% Local β works without internet
- β‘ Fast & Lightweight β no latency
- π§ Easy to extend β add conditions, schedules, or sensors
- π Works with any Shelly device
- Android phone with Tasker installed
- Home Assistant running on local network
- Shelly relay integrated with Home Assistant
- Both phone and HA server on the same Wi-Fi network
- Make sure your Shelly device is integrated in Home Assistant.
- Note the entity ID of your light (e.g.,
light.room_lightorswitch.shelly_relay). - Enable Long-Lived Access Token in your HA profile.
- Note your HA local IP (e.g.,
http://192.168.1.100:8123).
Optionally, use the provided automation YAML:
π See home-assistant/automation.yaml
- Import the Tasker profile from
tasker/ScreenLightControl.prf.xml. - Edit the HTTP POST task and update:
YOUR_HA_IPβ your Home Assistant local IPYOUR_HA_TOKENβ your Long-Lived Access TokenYOUR_ENTITY_IDβ your light/switch entity ID
- Enable the profile.
- Turn your phone screen ON β Light should turn ON
- Turn your phone screen OFF β Light should turn OFF
π Smart-Light-Control-Using-Tasker-and-Home-Assistant
βββ π README.md
βββ π tasker/
β βββ ScreenLightControl.prf.xml # Tasker profile (importable)
βββ π home-assistant/
β βββ automation.yaml # Optional HA automation
βββ π screenshots/
β βββ blueprint.jpg # System architecture blueprint
βββ π LICENSE
- π Night mode lighting β screen off = lights off automatically
- π‘ Automatic room light for better experience
- π Energy saving β no more forgotten lights
- π’ Smart Building / BMS demonstrations
Abdelkhalek Mammeri
Electronics Engineer | IoT & Smart Systems Developer
π Portfolio | π GitHub
This project is licensed under the MIT License.
