Two nasty surprises in Home Assistant's config
Last year, I motorized the rolling shutters on the southern façade of my apartment.<br>My idea was to manage them via Home Assistant.<br>I had a couple of automations in mind:
In the evening, roll down the shutters of my bedroom<br>In the morning:If it’s too hot outside, roll down all shutters<br>If it’s too cold outside, roll down all shutters<br>In other cases, roll up all shutters but my bedroom’s
Living in France, I added the official Météo France integration.<br>The integration provides different measurements, including air temperature for my city.<br>Here’s the historical data.<br>As you can see, it was pretty hot.
I could have used the temperature directly in the automation, but I wanted to define boolean sensors for "too hot" and "too cold" so I could reuse them across different automations.<br>I defined two custom sensors:
/homeassistant/configuration.yaml
template:<br>- binary_sensor:<br>- name: "Hot outside"<br>unique_id: hot_outside_condition<br>device_class: heat<br>state: ><br>{{ states('sensor.mycity_temperature') | float(0) >= 20 }}<br>- name: "Cold outside"<br>unique_id: cold_outside_condition<br>device_class: cold<br>state: ><br>{{ states('sensor.mycity_temperature') | float(0)
At this point, you can use the time for the trigger, and a sensor defined for the condition:
/homeassistant/automation.yaml
alias: Close all shutters in the morning when it's hot<br>description: Close all shutters if it's already hot in the morning<br>triggers:<br>- trigger: time<br>at: 06:00:00 (1)<br>conditions:<br>- condition: state<br>entity_id: binary_sensor.hot_outside<br>state:<br>- 'on'<br>actions:<br>- action: cover.close_cover<br>metadata: {}<br>data: {}<br>target:<br>entity_id:<br>- cover.volet_salon_gauc_low_speed (2)<br>- cover.middle_shutter_low_speed (2)<br>- cover.s_so_rs100_io_low_speed_3 (2)<br>- cover.s_so_rs100_io_low_speed_2 (2)<br>- cover.s_so_rs100_io_low_speed (2)
Time is relative to the timezone of the Home Assistant instance.
Unrelated, but I noticed that I need to work on my naming scheme
This year, I woke up earlier than last year.<br>Because I was awake when the automation was supposed to run, I noticed it didn’t.<br>After fiddling a bit around, I noticed that the problem was related to the time.<br>The UI showed a weird timezone: Paris/+1.<br>If you’re familiar with European time zones, you know about summer time.<br>We move one hour forward during summer, then back again in autumn.<br>However, it showed Paris/+1 instead of Paris/+2, though I was in summer.
I didn’t know if it was a bug or not, but it felt like it was.<br>The trigger time is relative to the instance’s timezone, as callout pointed out.<br>Stuck one hour behind, my automation fired exactly on schedule.<br>It was just an hour late compared to the actual time outside.<br>In any case, you can override the timezone in the configuration.
I did, and immediately lost the connection.<br>It turns out that once you override a single line in the homeassistant section, you lose all parameters set via the UI.<br>It comprises the temperature unit, the distance metric, but also the URL you can access it.<br>It falls back to the IP.
The fix is straightforward:<br>set every line again.
/homeassistant/configuration.yaml
homeassistant:<br>name: Home<br>time_zone: Europe/Paris<br>latitude:<br>longitude:<br>elevation:<br>radius: 30<br>unit_system: metric<br>currency: EUR<br>country: FR<br>internal_url: http://home.local:8123
Note that once you use YAML-based configuration, the whole UI block becomes invalid.
After the changes, the automation worked as expected.<br>Still, I shouldn’t have to set the timezone manually for summer time to apply correctly.<br>And I definitely shouldn’t lose all UI-related settings because of it.<br>Both feel like bugs on Home Assistant’s side, and a quick search confirmed they are:
Time-based automations can get stuck on the pre-Daylight Saving Time offset until Home Assistant restarts: issue on core#153175, closed as not planned<br>Setting a single key under homeassistant disables the whole General settings page in the UI, not just the key set: issue on frontend#14628, also closed as not planned
Good luck on your Home Assistant path.<br>I hope the above can be helpful.
To go further:
The configuration.yaml file
Home information
Home Assistant Core
Times of the day binary sensor out by one hour after switch to daylight saving
Unable to edit settings - general while a homeassistant: entry is in configuration.yaml
Follow me
Follow me
This is the 8th post in the My journey with Home Assistant focus series. This post will be short, but I hope useful. My home is getting more and more connected, and the number of my automations grow each month. Recently, I equipped my roller shutters with connected Somfy engines so they could roll down automatically when it’s too hot in summer. Spoiler: given the current heatwave, it’s a boon!
The more distributed a system, the harder it is to secure. Code crosses JVM boundaries. Objects are serialized across trust boundaries. Third-party proxies run inside your process. The usual answer is a network firewall....