Templates and Custom Sensors are a more advanced feature in Home Assistant. With Templates and Custom Sensors you can format and convert data so that it looks exactly the way how you want it to look. These are really powerful in Home Assistant and will help you in tailoring Home Assistant to your specific needs. In this video, I will explain how to create Templates and Custom Sensors in Home Assistant so that you can set this up yourself!
⭐⭐⭐ NOTE: ⭐⭐⭐
This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. In order to keep doing this, I would like to ask you to also check out the video, leave a comment under the video, give the video a thumbs up and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest tutorials about Home Assistant.
Thank you for your support!
Setting up Templates and Custom Sensors
The video tutorial explains in detail how Templates and Custom Sensors work in Home Assistant.
In the video we are going to build these use cases:
- Create a customized motion sensor message
- Show a different icon based on the motion sensor state
- Show a different icon color based on the motion sensor state
- Create a custom light counter sensor
- Create customized light counter message
- Show a different icon based on the light counter state
- Show a different icon color based on the light counter state
- Create a customized battery status indicator
- Show a different icon based on the battery state
- Show a different icon color based on the battery state
The final result will be something like this:
This video uses the “old” method of setting up template sensors. This is still supported by Home Assistant and works perfectly fine. The video gives you a good insight into how template sensors work. The modern way of setting up template sensors follows the same approach, but in that case, the sensors are stored in templates.yaml. You can watch this video to see how you can apply this.