@larre Good idea! Will look into it!
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?
Most solutions found here will turn off heater at intended departuer time.
I modified the solution that I chose to not turn off the heater, but selected to have a independet automation that monitors the car heter switch - if/when it turns “on”, then kick in, but delay for whatever period you prefer, in my case 2h, and then turn off everything.
From my point of view I could not see the benefit of turning off the heater as part of the start script, I mean, what is the problem with having power on in the outlet as long as the car is gone?
Right!?
I have a tendency to be… flexible in when i leave, not that great if you go outside 20 min later and its -25C, car will now be pretty cold again.
I do this at 22:00 every evening, and have it’s SUPER USEFUL. I have three checks that go every night. First run all year round and that is if the garage door is closed or not. If temp is below 5 outside it also checks if heater is plugged in and the car parked in the garage.I turn the plug on, wait 1sec, check load and then turn off. If load was < 5 I send notification to myself. All three saved me a lot last winter - probably will the one that is coming as well.
Where do I need to change my own outdoor temperature sensor?
Getting unknown with Calculated start time. So when I paste the template into HA template for testing. I get this error. UndefinedError: ‘str object’ has no attribute ‘strftime’ . I have tested each of the sensors that are used to calculate this time and all of those are working. Any ideas would be great.
- platform: template
sensors:
car_heater_start_time:
friendly_name: 'Calculated start time'
icon_template: mdi:clock
value_template: >
{% if states.sensor.car_heater_departure_time.state is defined %}
{% if ((states('sensor.car_heater_run_time')|float) > 0) %}
{{ strptime(((as_timestamp('1970-01-01 ' ~ states('sensor.car_heater_departure_time')) - (states('sensor.car_heater_run_time')|float *3600))|timestamp_local), '%Y-%m-%d %H:%M:%S').strftime("%H:%M") }}
{%else%}
Never
{%endif%}
{% else %}
waiting for sensors
{% endif%}
Fixed that error with ‘%Y-%m-%dT%H:%M:%S%z’ date formatter (instead of ‘%Y-%m-%d %H:%M:%S’) on two places in code, e.g:
{{ strptime(((as_timestamp('1970-01-01 ' ~ states('sensor.car_heater_departure_time')) - (states('sensor.car_heater_run_time')|float *3600))|timestamp_local), '%Y-%m-%dT%H:%M:%S%z').strftime("%H:%M") }}