Hi all,
I’m running HA 0.110.4 in docker on Synology, When I add the following sensor to the sensors.yaml, HA is not starting anymore.
- platform: sql
db_url: mysql://user:[email protected]:3306/HomeAssistant
scan_interval: 3600
queries:
- name: temp_max_today
query: "Select max(cast(state as decimal(10,1))) as max_temperature
from HomeAssistant.states where entity_id = 'sensor.00181709adb3d5_actual_temperature' and
date_format(created + INTERVAL 2 Hour, '%Y-%m-%d') = current_date()"
column: max_temperature
unit_of_measurement: "°C"
- name: sunshine_today
query: "select
truncate(sum(
cast(date_format(TIMEDIFF(next_time,time),'%i') as integer) * 60
+
cast(date_format(TIMEDIFF(next_time,time),'%s') as integer)
) / 60,0) +
round((sum(
cast(date_format(TIMEDIFF(next_time,time),'%i') as integer) * 60
+
cast(date_format(TIMEDIFF(next_time,time),'%s') as integer)
) / 60 / 60 mod 1) * 60,0) duration
from HomeAssistant.vwSunshineDuration
where next_time is not null"
column: duration
unit_of_measurement: "min"
It worked before, but I had many errors because the scan interval wasn’t set. So I added “scan_interval: 3600” and after that, no HA showed up. It doesn’t matter now if I remove the scan interval or not.
HA only works without the whole sql-sensor.
Is the integration too slow for my sql ?
Is there any solution to get the needed data in an other way ?