Hi, I’m still very new to this, slowly getting my head around things but I feel like I’ve hit a brick wall with this after diving down various rabbit holes trying to find a solution.
I want to use Forecast.Solar to decide when to run my heat pump for hot water for an hour, based on when solar production is forecast highest.
There is a sensor for this, sensor.power_highest_peak_time_today which is a timestamp - however this periodically changes during the day and it can update itself to be in the past if the forecast changes significantly, potentially meaning no hot water if I just rely on that sensor triggering an automation.
What I would like to do is to read sensor.power_highest_peak_time_today early in the morning and use its value as the time to run the hot water for an hour. Right now that sensor reads “2023-08-29T14:00:00+00:00” as an example. I’ve tried creating an input datetime helper and the following code as an automation, and various variations of it to try and get it to work including trying to convert the date/time format, with no success.
alias: Hot Water On - Based on ForecastSolar
description: ""
trigger:
- platform: time
at: "05:00:00"
condition: []
action:
- service: input_datetime.set_datetime
data:
timestamp: sensor.power_highest_peak_time_today
target:
entity_id: input_datetime.run_hot_water
mode: single
Can anyone help with this please? There’s a high chance I’m completely off the mark with how to do this, but I’m trying.
Hope this makes sense and apologies if this is straight forward to fix, I’ve spent a long time tinkering before getting to this point.
Thank you, that’s worked for me!
It turned out there was a 1hr discrepancy between the time shown on the dashboard for sensor.power_highest_peak_time_today and the actual values as shown under Developer Tools, but I’m pretty sure that’s down to the timezones being wrong in the docker containers which I will get around to sorting.
Hmm, something’s amiss here I think. I’ve sorted out the timezones in the containers and reloaded/rebooted etc and confirmed via terminal, Home Assistant’s timezone in settings is also correct.
The original script still copies the time across as per the sensor, but it’s an hour out in reality. The sensor reads “2023-08-31T11:00:00+00:00” in developer tools, it displays in the dashboard as “31 August 2023 at 12:00”, and copies across to the datetime helper as “2023-08-31 11:00:00” as read in developer tools, it also triggers the automation at 11:00 rather than the 12:00 I want it to.
I hoped your modified version would work, but that’s even worse - it copies across to the datetime helper as “2023-08-31 09:00:00” as read in developer tools and I can’t fathom how it’s working that out to be honest.
I have also checked the settings for Forecast.Solar for timezone settings, but there’s nothing to set.
Just to wrap this up in case anyone else tries to do what I’m doing and stumbles across this thread…I got what I wanted in the end, but used a different method.
I have given up on Forecast.Solar and started using Solcast instead. This doesn’t auto update, but needs an automation setting to trigger an update - which works well for me as I just update it at 05:00 and 20:00, and then use the relevant sensor for peak solar to trigger my hot water to come on.
Solcast’s data seems more accurate, and there’s a lot more available than Forecast.Solar provides too.