Student Techlife Student Techlife
  • Categories
    • Student Life
    • Technology
    • Home Assistant
    • 3D Printing
    • DIY
  • My House
  • My Projects
    • Home Assistant Glow
    • NIPKaart
    • Teddy Bear Hunting
    • NFC Scanner
  • Who am I?
  • Contact
0
842 Followers
165 Followers
Student Techlife Student Techlife Student Techlife
  • Categories
    • Student Life
    • Technology
    • Home Assistant
    • 3D Printing
    • DIY
  • My House
  • My Projects
    • Home Assistant Glow
    • NIPKaart
    • Teddy Bear Hunting
    • NFC Scanner
  • Who am I?
  • Contact
  • Home Assistant
  • Student Life

What task do we do today? ✅

  • July 9, 2019
  • Klaas Schoute

Today a blog about the household and how you can make it a little bit smarter, and easy to track. If you have a house then you can’t escape it, someday you’ll have to do something in the household if you want to live comfortably.

The usecase

I want to be able to keep track in Home Assistant when a household task was last done, how many days ago and with a simple click I can change the date to today. This works with the main tasks that come back once a week or 2 weeks.

Inspired by a piece of paper with tasks in a week schedule, I started to convert this usecase into something workable in Home Assistant. Below I will discuss what I have made per integration / platform in Home Assistant. You can find the references to the github files by clicking on the name of a yaml file.


Input_datetime

First I created an input_datetime (household.yaml) for each task, provided with a friendly name and a tracking on the date only (in my view time is not necessary). See also code below.

vacuuming:
  name: Vacuuming
  has_date: true

Sensor

Then we use a template sensor (household.yaml) to calculate when a task was last done in days. It’s important that you first make a date or time sensor of the time_date integration. Then you can make the template sensors, don’t forget the “entity_id: sensor.date“ or “entity_id: sensor.time”! This ensures that the template sensor updates itself every day or every minute, because it responds to the state change of the entity.

# Vacuuming
- platform: template
  sensors:
    days_after_vacuuming:
      friendly_name: Days after vacuuming
      entity_id: sensor.time
      unit_of_measurement: 'days'
      value_template: "{{ ((as_timestamp(now()) - state_attr('input_datetime.vacuuming','timestamp')) | int / 86400) | round(0) }}"

Input_select

We are now going to work on the piece in which we can adjust the date.
To update the date I use an input_select (household_task.yaml) for choosing the task.

household_task:
  name: Select Household Task
  options:
    - Stofzuigen
    - Dweilen
    - Badkamer schoonmaken
    - Toilet schoonmaken
    - Afstoffen
    - Beddengoed verschonen
    - Studio opruimen

Script

Then I created a script (household.yaml) that actually updates the date when you press execute and it knows which task it needs to update, based on the input_select from above.

Lovelace layout

We can now make a start on the layout in lovelace (household.yaml).
For this I use a number of cards and I also made a separate view in my config.

The structure
-| Vertical stack in card
—-| Love lock card
——–| Entities card
————| Secondaryinfo entity row card
—-| Entities card

I have divided it into 2 parts:
– 1st part shows the tasks with number of days ago and the date.
– 2nd part is to select and update a task with a new date.

To prevent that you can simply change the date, the first part is in a love lock card and the number of days ago I show through a secondaryinfo entity row card.

Notifications

After publishing, there appeared to be some little problems in the notification, which I have now hopefully fixed. The blog has been adjusted to the new changes. Related Github commit.

Finally, I wanted Home Assistant to send a notification when a task had to be picked up.

For this automation I spent a whole night for brainstorming and debugging, the challenge was to cram everything into 1 automation (I failed 🙁 ), in a way that everything works well and the action only returns tasks that exceed the threshold.

Afterwards I split the first automation into 2 automations (household.yaml), one for triggering and giving the green light. The other will actually send the notification based on the given green light.

First automation

The first automation is triggered based on when the number of days (numeric_state) from the task sensors exceeds a certain value (also called as threshold), in this case above 6 (1 week) or 13 (2 weeks). There are now also several conditions. The first is to prevent you from receiving a notification every time you restart Home Assistant. I prevent this with a input_boolean thats requiring my maintenance mode to be “off” (I always have this mode “on” when I working on the config).

condition:
    # This prevents triggering after every HA restart
    - condition: state
      entity_id: input_boolean.maintenance_mode
      state: 'off'

The following condition is to prevent you from being spammed several times in succession with the same notification. If 2 or more count sensors exceed the threshold value, only the first one now comes through. I do this by adding an extra input_boolean (task_notify.yaml) that must also be switched “off”.

# Prevents multiple notify messages :)
- condition: state
  entity_id: input_boolean.task_notify
  state: 'off'

The action consists of no more than turning “on” the same input_boolean (task_notify) from above.

Second automation

The 2nd automation is triggered by the state change from the input_boolean (task_notify) to “on”.

The action is full of if statements, per task it checks whether the sensor value is above the threshold. If so then the task will be displayed in the message, if not then it will be an empty line. As an extra option, it also shows the number of days from the task sensors.

What brings the future?

In the future I would like to determine the threshold value with an input_number, probably the automation will have to be split if you want to use more than 1 threshold.


Are things not clear? Or if you have come to ideas by reading this blog, about how I can make it cooler and better? Share it with me! Via Twitter, mail or Github.

Alternative

If you afterwards think that this approach does not suit in your config (which is possible ofcourse), then take a look at the Grocy add-on, the custom component from Grocy and the custom lovelace card from Isa (@teachingbirds).

Share
Tweet
Share
Klaas Schoute

Interaction technology (UX/UI) student who loves home automation, drones, open source projects and likes to take you on his adventure to the perfect smart student house.

Related Topics
  • automation
  • household
  • lovelace
  • tasks
  • tracking
Previous Article
  • 3D Printing
  • College
  • Student Life

Yes! I / we made it! 🎓

  • June 28, 2019
  • Klaas Schoute
View Post
Next Article
  • Student Life

Finally holiday without leakage 🏕️

  • August 6, 2019
  • Klaas Schoute
View Post
You May Also Like
View Post
  • Home Assistant
  • Integration

easyEnergy market prices with new integration in Home Assistant

  • Klaas Schoute
  • February 26, 2023
View Post
  • Home Assistant
  • Integration

EnergyZero market prices with new integration in Home Assistant

  • Klaas Schoute
  • January 11, 2023
View Post
  • Projects
  • Student Life

🅿️ NIPKaart project update

  • Klaas Schoute
  • August 22, 2022
View Post
  • College
  • Home Assistant
  • Student Life

It’s a long time ago

  • Klaas Schoute
  • June 3, 2022
View Post
  • Home Assistant

First integration in Home Assistant!

  • Klaas Schoute
  • June 2, 2021
View Post
  • DIY
  • Home Assistant

Blitzwolf LT11 with ESPHome

  • Klaas Schoute
  • March 11, 2021
Green light in the bathroom
View Post
  • Home Assistant
  • Student Life

How I save water while showering🚿

  • Klaas Schoute
  • December 25, 2020
View Post
  • Home Assistant
  • Student Life
  • Technology

Is this going to be the future?

  • Klaas Schoute
  • November 4, 2020
3 comments
  1. Marc says:
    March 17, 2021 at 22:46

    I really like this post! Thanks a lot.

    I did find two dead link. Which are the first link in the Sensor paragraph and the link in the Script paragraph.

    Reply
    1. Klaas Schoute says:
      March 17, 2021 at 23:29

      Thnx for letting me know! It has also been immediately adjusted.

      Reply
  2. Thomas says:
    September 10, 2021 at 21:51

    Thanks for your posting, that’s exactly what I am looking for: to utilize a mechanism to track and remind me of some recurring maintenance tasks like changing the filter of the extractor hood, cleaning up the brewing unit in the coffee machine or checking the water pressure in the gas boiler..

    I found different solutions for this but yours is the cleanest I found. I like it, thank you!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Author
Klaas Schoute
Interaction technology (UX/UI) student who loves home automation, drones, open source projects and likes to take you on his adventure to the perfect smart student house.
Recent Posts
  • easyEnergy market prices with new integration in Home Assistant February 26, 2023
  • EnergyZero market prices with new integration in Home Assistant January 11, 2023
  • Let’s contribute! Hacktoberfest 2022 October 2, 2022
  • 🅿️ NIPKaart project update August 22, 2022
  • It’s a long time ago June 3, 2022
Instagram
klaasnicolaas
When the weekend is almost over 😥
Iedereen een gelukkig nieuwjaar! 🥂
Finally received my @chonkerkeys last week, now online meetings are even more fun! 😁
Wauw wat een mooie show! Als je nog niet geweest moet je zeker gaan, kan nog t/m december 2022 (is alweer verlengd). #soldaatvanoranje #valkenburg #theaterhangaar
Follow


Student Techlife Student Techlife
  • Categories
  • My House
  • My Projects
  • Who am I?
  • Contact
Make a student life smarter

Input your search keywords and press Enter.