Sunrise and sunset in a smart home

Igor Mullin
3 min readAug 17, 2021

--

In each house there are several actions that are related to the time of day. For example, turn on the lamp or switch the device to night mode or change the temperature in the room.

This is a translation of my article in Zen. Also read us in other services: Instagram channel and telegram channel (RU, EN, DE), Medium, LiveJournal, YouTube.

In the Mi Home automations, you can set the “Sunrise” and “Sunset” trigger. But for Chinese devices, there are only Chinese cities, plus it needs the Internet to work. Therefore, we transfer automation to the home assistant and synchronize it with the sun outside our window.

To begin with, I will remind you of the link about automation (RU). By similarity, we create a similar one, but we will choose the trigger type “sun”, and the event “sunrise”. As an action, we will choose several lamps in the apartment.

Now we need to create a reverse action, but first in the current automation, click “edit in YAML”. Copy the text of the automations

Let’s open a new automation in a new tab. The trigger type is “sun”, and the event is “sunrise”. In the actions section, just copy the text from the “dawn” automation. Now the last action: “turn_off” needs to be replaced to “turn_on”.

Of course, the text method is not for everyone, but when there are hundreds of devices in an apartment, it is inconvenient to select devices every time from the drop-down list

Subscribe, like, repost…
This will really help articles to be published more often. And yet, among the Zen subscribers-there will soon be a small lottery ☺.

--

--

Igor Mullin
Igor Mullin

Written by Igor Mullin

I´m a Hardware and Software Engineer and a PhD. In my professional activity I focus on such things like smart home systems and electric development.

No responses yet