<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw" -->

---
title: Holiday Lighting with Sonoff, Tasmota, and Home Assistant
description: A practical walkthrough of replacing mechanical holiday light timers with smart plugs using Sonoff S26 hardware flashed with Tasmota firmware, integrated into...
canonical: https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Holiday Lighting with Sonoff, Tasmota, and Home Assistant | daily.dev
og:description: A practical walkthrough of replacing mechanical holiday light timers with smart plugs using Sonoff S26 hardware flashed with Tasmota firmware, integrated into...
og:url: https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw
og:image: https://api.daily.dev/og/posts/j6YIJDwFW.png
og:image:alt: Holiday Lighting with Sonoff, Tasmota, and Home Assistant
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Holiday Lighting with Sonoff, Tasmota, and Home Assistant

**[apalrd's adventures](https://daily.dev/sources/apalrd)** · 3 min read · 0 upvotes · 0 comments

## Summary

A practical walkthrough of replacing mechanical holiday light timers with smart plugs using Sonoff S26 hardware flashed with Tasmota firmware, integrated into Home Assistant via MQTT. The setup enables local-network control with no cloud dependencies, and uses sun-based automations in Home Assistant YAML to turn lights on 30 minutes after sunset and off 4 hours later, automatically adjusting as seasons change.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.apalrd.net/posts/2021/holiday_lights>

## Questions this post answers

### How do I set up a sun-based automation in Home Assistant to turn lights on after sunset and off a few hours later?

A single Home Assistant automation with multiple triggers handles both on and off events without using delays (which can fail on server restart). One trigger fires 30 minutes after the sun drops below the horizon to turn lights on; a second trigger fires 4 hours after that to turn them off. Using event-based triggers instead of delays makes the automation resilient to restarts.

_Developers building Home Assistant automations share patterns like this on daily.dev._

### How do I integrate a Tasmota-flashed Sonoff plug into Home Assistant using MQTT instead of the Tasmota integration?

Add the Tasmota device as an MQTT switch in Home Assistant's switch.yaml file, using the MQTT topic structure configured on the device. This approach keeps all control on the local network with no cloud dependencies and works well when the device was previously managed by Node-RED with a custom topic layout, bypassing the native Tasmota integration entirely.

_Those migrating smart home setups away from cloud dependencies track local-control approaches on daily.dev._

## Similar posts on daily.dev

- [These Home Assistant Prime Day deals transformed my smart home, but one was the game-changer](https://daily.dev/posts/these-home-assistant-prime-day-deals-transformed-my-smart-home-but-one-was-the-game-changer-wovzlrgtg) · XDA Developers · 0 upvotes · 0 comments
- [Home Assistant waters my plants\!](https://daily.dev/posts/home-assistant-waters-my-plants--i0o9wij2e) · Hacker News · 0 upvotes · 0 comments
- [I gave my smart home a bedtime button, and it actually makes every night a little bit easier](https://daily.dev/posts/i-gave-my-smart-home-a-bedtime-button-and-it-actually-makes-every-night-a-little-bit-easier-1t68byctr) · XDA Developers · 0 upvotes · 0 comments
- [SONOFF BASIC-1GSP Matter over WiFi smart switch supports DIN rail mounting, real-time energy monitoring](https://daily.dev/posts/sonoff-basic-1gsp-matter-over-wifi-smart-switch-supports-din-rail-mounting-real-time-energy-monitor-wdwzijxsu) · CNX Software · 0 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend)

[View this post on daily.dev](https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Holiday Lighting with Sonoff, Tasmota, and Home Assistant","url":"https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw"},"datePublished":"2026-08-11T08:55:34.382Z","dateModified":"2026-08-11T09:35:14.596Z","description":"A practical walkthrough of replacing mechanical holiday light timers with smart plugs using Sonoff S26 hardware flashed with Tasmota firmware, integrated into...","image":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","thumbnailUrl":"https://media.daily.dev/image/upload/s--2-1xRawN--/f_auto/v1722860399/public/Placeholder%2011","isAccessibleForFree":true,"articleSection":"apalrd's adventures","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"apalrd's adventures","logo":"https://media.daily.dev/image/upload/s--4zkx8dRj--/f_auto,q_auto/v1786438309/logos/apalrd?_a=BAMAMicg0","url":"https://daily.dev/sources/apalrd"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"apalrd's adventures","item":"https://daily.dev/sources/apalrd"},{"@type":"ListItem","position":3,"name":"Holiday Lighting with Sonoff, Tasmota, and Home Assistant"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/holiday-lighting-with-sonoff-tasmota-and-home-assistant-j6yijdwfw#faq","mainEntity":[{"@type":"Question","name":"How do I set up a sun-based automation in Home Assistant to turn lights on after sunset and off a few hours later?","acceptedAnswer":{"@type":"Answer","text":"A single Home Assistant automation with multiple triggers handles both on and off events without using delays (which can fail on server restart). One trigger fires 30 minutes after the sun drops below the horizon to turn lights on; a second trigger fires 4 hours after that to turn them off. Using event-based triggers instead of delays makes the automation resilient to restarts. Developers building Home Assistant automations share patterns like this on daily.dev."}},{"@type":"Question","name":"How do I integrate a Tasmota-flashed Sonoff plug into Home Assistant using MQTT instead of the Tasmota integration?","acceptedAnswer":{"@type":"Answer","text":"Add the Tasmota device as an MQTT switch in Home Assistant's switch.yaml file, using the MQTT topic structure configured on the device. This approach keeps all control on the local network with no cloud dependencies and works well when the device was previously managed by Node-RED with a custom topic layout, bypassing the native Tasmota integration entirely. Those migrating smart home setups away from cloud dependencies track local-control approaches on daily.dev."}}]}
```

