I have made the following code so that the total time a tv is on for is calculated, the sql query through mariadb works and created a sql sensor as well.
alias: New Automation
description: “”
trigger:
- platform: time
at: “23:59:59”
condition:
action: - service: notify.homeass_c_58_gmail_com
metadata: {}
data:
target: [email protected],[email protected]
message: The TV was on for {{(sensor.select_sql_query_3)}}
mode: single
In traces the following error comes up:
Error: Error rendering data template: UndefinedError: ‘sensor’ is undefined