Create your OWN Template Sensor with Home Assistant Coding Tutorial

Create your OWN Template Sensor with Home Assistant Coding Tutorial

Smart Home Makers

2 года назад

54,726 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

ArranAshy
ArranAshy - 10.09.2023 13:16

Thank you so much! Great for presenting custom ESPHome devices better!

Ответить
Damien D
Damien D - 29.08.2023 03:16

Excellent Tutorial. I'm an experienced coder but a noob to Home Assistant so I needed some help to get over the first hurdles in a new interface and language. This was exactly what I needed. I'll be watching your whole series when I have time. Thanks.

Ответить
B Gable
B Gable - 12.08.2023 19:09

Enjoying your video's! Very helpful! HOWEVER, I missed the part where the "sensor.tumble_dryer_power" entity came from. Did you define it as part of the Shelly1PM? I'm currently only using esp's.

Ответить
Argonauta34
Argonauta34 - 04.07.2023 20:36

Hello and congratulations for the home assistant videos, I need help on the dryer status template. How can I insert a delay that if it is under 6 w for 10 seconds is it stanbay?

Ответить
David Smith
David Smith - 20.05.2023 03:02

This is what I was looking for. Thank you so much.

Ответить
Adrian Mak
Adrian Mak - 20.04.2023 12:19

the sensor name will convert to xxxx_xxxx from name in template automatically right ?

Ответить
Your Property Matters
Your Property Matters - 23.03.2023 19:40

You create the code in templates but then you don't use that when you're typing the code into the config yaml so I am confused. I have got my code in the template but what do i do with that? I cannot see why you do that first as you just create some different code in the config yaml

Ответить
Louis Carter Jr.
Louis Carter Jr. - 05.02.2023 19:00

Thanks for all the work and time you have given us. I was not able to use the term state. When I went looking on other sites I found a different way of creating sensor as follows
- platform: template
sensors:
quickpot:
friendly_name: 'fastcook'
value_template: >
{% if states("sensor.dishwasher_energy_current") | float == 0 %}
OFF
{% elif states("sensor.dishwasher_energy_current") | float <= 2 %}
Stand by
{% elif states("sensor.dishwasher_energy_current") | float <= 4 %}
warming
{% else %}
cooking
{% endif %}
Have things changed in HA?

Ответить
xXDeadJesterXx
xXDeadJesterXx - 06.01.2023 16:42

Setting up an automation for our dryer is the one thing I've been unable to do so far. I live in the U.S. and we have the funky plugs for our dryers, so using a normal power monitor smart plug won't work. I've heard of Shelly before, do you have a link to the one you used? I know Shelly offers some products here in the US, so hopefully I can get one that will work.

Ответить
Russ Gulley
Russ Gulley - 30.12.2022 05:40

Thanks for the great video!

I'm using Developer Tools, Template
But, I'm stuck here is my code:

```
(% if states("number.humidifier_target_level") == 55 %)
off
(% else %)
on
(% endif %)
```
I am getting this error:
This template does not listen for any events and will not update automatically.

I have checked the States and it shows 55.

Any help would be greatly appreciated!
TIA

Ответить
louis viciedo
louis viciedo - 26.10.2022 22:00

Thanks Gio, a great video on templates! Much needed as I expand my use cases in HAS. By chance do you have a video that returns a specific entity that triggered an automation? For example I have 5 smoke sensors and I want my notification to return the specific sensor that triggered the automation. Thank you!

Ответить
Peter C
Peter C - 24.09.2022 17:34

How do we know when drying finishes to get notifications?

Ответить
Rudy Henderson
Rudy Henderson - 09.09.2022 07:35

Studio Code editor throws immediate error
template:
- sensor: incorrect type expected array
state:

Any ideas? thx

Ответить
Gladers
Gladers - 27.08.2022 13:14

Could you make a video where you make a value depending on the states of 2 diffrent sensors?

Ответить
Andre Jo
Andre Jo - 17.08.2022 04:28

Imej itu terlalu menyinggung perasaan

Ответить
Jorge Fernández
Jorge Fernández - 04.07.2022 20:12

wooooww just what I was searching. thank you very much!!!

Ответить
Tym Peters
Tym Peters - 03.07.2022 01:37

Thank you so much. Just two weeks into Home Assistant and struggling with 'custom sensors.' This was the perfect introduction!

Ответить
Bobby
Bobby - 20.05.2022 14:38

I followed this video to a T. My template works within the generator but every line of code throws back an error. As soon as i write the word template: i cant seem to correct it at all.

Ответить
Thad
Thad - 17.05.2022 18:50

Thank you for making this video. I'm a programmer by day, but a lot of the explanations around custom sensors seemed as clear as mud until I found your video. This breaks it down and explains it very clearly. You have saved me a lot of future headache, thank you so much for the simple and concise explanation!

Ответить
Celine Vermolen
Celine Vermolen - 15.05.2022 21:32

Very clear and much obliged. Only struggle here is to make the outcome of the if/else a trigger for an automation. I.e. if status dryer changes from standby to drying: send me a message or whatever action needed.

Ответить
KOKOS
KOKOS - 30.03.2022 10:41

it will work with sonoff ewelink?

Ответить
Jeremy Seaward
Jeremy Seaward - 13.03.2022 11:37

thanks for the tutorial! i'm getting this error, any idea what is going wrong here?

'float' got invalid input 'unknown' when rendering template '{% if states("sensor.dryer_power")|float == 0 %} Off {% elif states("sensor.dryer_power")|float <= 4 %} Standby {% else %} Drying {% endif %}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1

Ответить
John Wade
John Wade - 03.03.2022 16:24

1000 times Thank you!! Being new to this is overwhelming but you helped greatly!! I made a simple little sensor to show whether I'm home or not... it's a start to bigger and better things :)

Ответить
Shawn Richards
Shawn Richards - 02.03.2022 08:36

Can home assistant be used to send IR or RS232 command to control tv, audio receivers etc…?

Ответить
Onepointbrewing
Onepointbrewing - 01.03.2022 16:28

+1 for the tutorial. I have no experience with ginja so this is great

Ответить
MostHated
MostHated - 27.02.2022 03:19

Are you kidding? My wife would love a tumble dryer as a present. Definitely do that.

Ответить
Damuson
Damuson - 24.02.2022 02:50

Can you assign a unique id to the template sensor?

Ответить
Ryan Trainor
Ryan Trainor - 16.02.2022 18:59

Can this be used to make a virtual motion or contact sensor in HA?

Ответить
thepyropc
thepyropc - 09.02.2022 08:12

HEy whenever i do the check i get a config invalid for

Integration error: name - Integration 'name' not found.
Integration error: platform - Integration 'platform' not found.
Integration error: host - Integration 'host' not found.

i have no errors on my code and it is exactly the same as yours other than the name ( i am running mine for the washer right now)

Ответить
Alex Capone
Alex Capone - 06.02.2022 19:45

I am trying to evaluate the last notification on my phone whether it contains a list of words and if NOT contain any of the specified words then it should update the sensor. What is the best way to write this code?

Ответить
N. R.
N. R. - 30.01.2022 22:31

You have just solved me another problem …. just one question left: how do you describe a value between two values let’s say „if sensor value is>= 40 but <=50“ ? Thanks for you’re help.

Ответить
N. R.
N. R. - 30.01.2022 22:28

Danke!

Ответить
altussss
altussss - 10.01.2022 23:08

plenty of examples presented in a simple way 😁👍

Ответить
Street Freaks Racing Videos
Street Freaks Racing Videos - 07.01.2022 05:15

Excellent! I had no idea what templating was! I actually had made one months ago I think, made a switch and a contact sensor into a cover(garage door). But you explanation of those crazy brackets was super helpful, last time I did any programming was in the early 80’s and it was the Basic language, so I’m pretty much less than zero on programming knowledge. Thanks a bunch!

Ответить
Ash Scott
Ash Scott - 03.01.2022 13:40

Well done. That's clarified a whole bunch of things. Thank you.

Ответить
Jaco Van der Merwe
Jaco Van der Merwe - 01.01.2022 12:37

Once again, thanks for a very helpful video. Your content selection and quality is constantly growing and I enjoy your channel 👍

Ответить
Brent Wesley
Brent Wesley - 01.01.2022 02:08

Thanks for the video. BTW you have a spelling mistake in your splash screen. Cobing instead of Coding :D

Ответить
Etienne dk
Etienne dk - 31.12.2021 23:05

Nice bite size & useful intro to templates.

Ответить
Robert Chamberlain
Robert Chamberlain - 31.12.2021 21:42

Sir, you have opened my mind to new ideas! I've seen the dryer power monitor before and it's on my list of to-dos, but you have me thinking about it differently. Thank you! I feel better prepared to get started.

Ответить
Ron M
Ron M - 31.12.2021 05:38

Nice! Thanks.

Ответить
Øystein Gåsdal
Øystein Gåsdal - 31.12.2021 03:54

Love your coding videos. Keep up the good work. Could you maybe do a sensor for daily power consumption?

Ответить
Chris Chiu
Chris Chiu - 31.12.2021 03:17

Thanks for the video. I followed everything you did but after restarting I do not get a new sensor.tumble_dryer. Any idea why?

Ответить
VegasWayne
VegasWayne - 31.12.2021 00:47

Thanks for the video. I got it to work with a Sonoff S31PM by using {% if state_attr('switch.sonoff_s31pm', 'power') == 0 %} in place of what you were using.

Ответить
Robin De Becker
Robin De Becker - 31.12.2021 00:21

This video will help me a lot with templating. Always had struggles with it, but now it is more clear for me. Many thanks 🙂

Ответить
Kuba Wolanin
Kuba Wolanin - 30.12.2021 23:04

Thanks for the tutorial, really nicely explained.
I wish there was entities ID autocomplete in this editor, just like in VS Code.
Would make playing around it so much easier.

Ответить
Kodey Patterson
Kodey Patterson - 30.12.2021 20:03

Great video

Ответить
Rick Z
Rick Z - 30.12.2021 19:27

Thank you for this, I have searched for any syntax documentation for creating templates and have had to rely on looking at other users code for clues, can you point at such documentation? For example I first thought to use a case statement rather than if but can’t find if one is available for use!
I also found that I could just update templates rather than restarting HA, saved a ton of time with my many errors and restarts.

Thanks for what you are doing to help us all!

Ответить
Geoff Farmer
Geoff Farmer - 30.12.2021 18:44

Great video. Thank you

Ответить
Akram Hussain
Akram Hussain - 30.12.2021 18:11

Thanks for the information.. I like the sound of the keyboard.. Can you tell me what kind it is?

Ответить