Did you change the entity id of your outside temperature sensor?
Sorry im really noob for HA. Where i but it?
Thanks for sharing.
Will try it out. Currently I’m using Tasker on Android to do the same based on when my alarm is set.
One thing I’m missing from my Tasker integration is to be able to set “Extra heat time”
Lets say my “Departure time” is set to 06:30. Since my working schedule is flexible I actually leave sometime between 06:30-07:00. Hence I would like a slider to add extra heat time in minutes. So when I slide it to 30 minutes the actual off time would be 07:00.
The heat time calculation should still calculate against 06:30, and just let it heat a little longer if I don’t leave on time.
Basically the “Stop engine heater at departure time” automation should take “states.sensor.car_heater_departure_time.state” + extra_heat_time
Would you consider adding this feature?
I still get this error though, can this be ignored?:
Update for sensor.car_heater_3h_before_start_time fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 268, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 446, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/components/template/sensor.py", line 248, in async_update
self._state = self._template.async_render()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 215, in async_render
return compiled.render(kwargs).strip()
File "/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 2, in top-level template code
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
Maybe not a robot for connecting the cable but I have an idea to create an additional automation that activates the switch for 30 seconds around 22.00, measures if there is any load and, if no load and car heater is active, send me a notification.
I am still waiting for a Sonoff in the mail to play with it though.
Hello and thank you! It works almost perfect but my heater needs to run a little longer. What do I need change? Thank you in advance. I found it. I changed 0.05 to a higher number.
Use the online calculator here:
Here I have put the values I used to get the equation:
10 degrees = 0.5h
-10 degrees = 1.5h
Equation: y= -0.05x +1
10 degrees = 0.5h
-10 degrees = 2h
Equation: y= -0.075 + 1.25
Change this line accordingly:
{{(states(‘input_number.car_heater_3h_before_temp’)|float * (-0.05) + 1)|round(1)}}
I use the second example (2h when -10 degrees) now since I also noticed that I need to run it a little bit longer when it’s cold.
{{(states(‘input_number.car_heater_3h_before_temp’)|float * (-0.075) + 1.25)|round(1)}}
These errors can be ignored if they appear when restarting home assistant. I have not figured out how to get rid of them.
Thank you!
Thanks for the explanation, but be aware, using this example or any value that makes the possible run time longer than 2,5 hours:
{{(states(‘input_number.car_heater_3h_before_temp’)|float * (-0.075) + 1.25)|round(1)}}
Makes the maximum heating time 3,5 hours. Meaning that already at -23 degress the run time will be 3 hours hence the sample temperature automation won´t run on time.
Changing:
{{ strptime(((as_timestamp('1970-01-01 ’ ~ states(‘sensor.car_heater_departure_time’)) - (10800))|timestamp_local), ‘%Y-%m-%d %H:%M:%S’).strftime("%H:%M") }}
to:
{{ strptime(((as_timestamp('1970-01-01 ’ ~ states(‘sensor.car_heater_departure_time’)) - (12960))|timestamp_local), ‘%Y-%m-%d %H:%M:%S’).strftime("%H:%M") }}
Should fix it and the sample temp will be checked 6 minutes before the max 3,5h run time.
Can somebody help me adding “extra heat time” slider so I can heat for x minutes after departure time? I can´t get my head around it.
I just found out that the slider for sample temp goes from -30 to +30.
But the automation that gets the sample temp actually sets the temperature to whatever the actual temperature of the senor is.
So if you live far north the temperature can actually be lower than -30 and then this action sets it to whatever it is:
action:
service: input_number.set_value
data_template:
entity_id: input_number.car_heater_3h_before_temp
value: '{{ states.sensor.ute.state }}'
This sets the calculated run time too late since it actually should already have started.
I’m not good at all the “if else” stuff in yaml otherwise I would try to help out at github.
But what the above action needs is something like:
If sensor <-30
set value to -30.
Else
set value to: actual sensor value.
I just wanted to share my lovelace setup for this package, I think i turned out really niceley, maybe it will help someone
(it 's in swedish but I think you will be able to change it to your language)
You will need two community plugins and one community integration.
Integration:
- Browser mod (for the settings popup)
Plugins
- Vertical Stack In Card (to combine multiple cards in one)
- Button Entity Row (for the buttons)
Lovelace code:
type: 'custom:vertical-stack-in-card'
title: Motorvärmare
cards:
- entities:
- entity: sensor.heater_departuretime
- entity: sensor.heater_activationtime
- entity: sensor.heater_temptime
- entity: sensor.heater_forecast
name: Prognos
show_header_toggle: false
title: null
type: glance
show_icon: false
- entities:
- type: 'custom:button-entity-row'
buttons:
- entity: input_boolean.heater_active
name: Aktiv
state_icons:
'off': 'mdi:play'
'on': 'mdi:pause'
- entity: switch.shelly_outside_garageport_right_socket_switch_2
name: Manuell start
state_icons:
'off': 'mdi:play'
'on': 'mdi:pause'
- entity: sensor.heater_forecast
name: Inställningar
icon: 'mdi:settings'
service: browser_mod.popup
service_data:
deviceID: this
title: Inställningar motorvärmare
card:
type: entities
entities:
- entity: input_number.heater_hour
- entity: input_number.heater_minute
- entity: input_number.heater_delay
- entity: input_number.heater_maxmin
- entity: input_boolean.workdays_only
show_header_toggle: false
title: null
type: entities
Winter slowly coming closer - again…
Slowly trying to wrap my head around yaml, powerfull as it seem it is a bit like reverse Polish notation - a bit backwards…
How to edit the setting of sampled temperature if the departure time is less than 3h from “now”?
Can that be tested/done in the platform sensor for departure time, or should it be in the automaton (sample temp 3h before dept)?
Just to clarify, which entites is needed to change according to my own configuration?
Hi! I still possible to use this?
And for the time of departure, and instead of sample temp maybe it’s possible to use some from here?
I tried both, but I don’t recall that I got Gnaget’s to work.
Comming from the old plain 433Mhz Nexa environment HA is a challenge. The heater script that I had in Nexahome (aka Easyhome by Henrik Kjell) was in many ways far more advanced than anything I have seen in HA. For this to work in HA I thinkt that we need a modified Generic Thermostat integration. The GT has some of the fundamentals, as monitoring outdoor temp and controlling a switch, but for the engine heater we need a timer rather than the indoor target temp as the agent for turning it of.
Just trying to handle it by a plain automation will not work.
On the requirement list:
- be able to set a number of standard departure times weekdays and hh:mm (morning to office, afternoon for various activites etc)
- random/ad hoc departure, both as delta (in 1h, in 2h) or as hh:mm with a choice of run-time
This is great!! Så jäkla grymt!
I will have to implement this to my car today also the cold have come to Sweden again
One thing that I have is i do have a xiaomi temp sensor in my car so could there be a cut off if temp is more than a set max temp and if there is no temp from the sensor it falls back to the calculation?
I cant get this Nylunds to work!
No problems but it is not turning on the outlet.
Får inte detta paket att fungera från Nylund. Vad måste jag göra för att få min Nexxa plug att slå på och av? väder har jag från met.no
Macce
I ended up with this solution instead:
as I wanted to meet the following requirements:
- possibility to create scheduled departures for regular activities (like various evening activities - morning departures gone with Covid19)
- possibility to have at least one ad-hoc upcomming planned departure, like shopping @ 14:30 today
- possibility to start now (and leave any time within 2hrs)
I have not yet implemented the dynamic runtime on the ad-hoc time based setting, but that should only require an input_number helper, currently I will rely on the default 2hr max automation.
Some kind of countdown timer would also be nice…
The concept will be put to test as the chill closes in, but for the last week or so it has got milder rather than colder so testing conditions are not going my way :-/
Hej alla svenskar! Lite kul att detta är ett så överväldigande svenskt fenomen
But lets stay understandable for others as well.
I’m also working on a car card:
It’s for now based on a wemos D1 mini sending interior temps via wifi/mqtt, every 2 minutes.
I have ordered a sonos S55 for car heater outlet, and these solutions look quite nice… However, i would also like an auto turn off, for example if i want to use the car on a sunday afternoon i would want to turn heater on, and then the outlet would be active for maybe three hours. Or perhaps three hours OR until car leaves, whatever comes first?
I also wonder how these templates handle departure time, do they turn off at set departure time or the classic 30 minutes later?