Hello everyone
After two full days of testing and trying my way through several forums, I’m now turning to you with my problem in the hope that someone knows and can help me
My HA recorder runs via MariaDB, so I already have a database available on the Intel NUC on which HA runs.
I would also like to include external data here, so for the sake of simplicity I have simply added another table to the Homeassistant database where I can store these data.
I automate my home cinema with HA, among other things, and would like to use additional data about films that are played on the xBox, which I would like to use for automation purposes and store in this database (image format, playing time, etc.).
For the automations, I dynamically extract my own entities from the attributes of the xBox media player, which I have defined in a templates.yaml. Works great, and the resulting automations also work great.
For some data that cannot come “live” from the xBox, I need this database. Here I would like to use the film title to match a database entry with the data stored there.
I created a sql.yaml, which I referenced from the configuration.yaml, where I want to form my SQL query entities, which also works.
Now to the problem:
If I use an entity as a WHERE clause (that contains the film title that I want to search for), the resulting entity gives me an “unknown” as a result.
If I use exactly the same query and replace the film title entity with words (I basically write a film title directly into the WHERE clause), the result with the corresponding data from the database comes without any problems.
This doesn’t work, result: “unknown”
- name: SQL_FilmDaten
query: >
SELECT
*
FROM
x_kino_movies
WHERE
name = 'sensor.xbox_filmtitel'
LIMIT
1;
column: "name"
unique_id: "sql_filmdaten"
This, however, works:
- name: SQL_FilmDaten
query: >
SELECT
*
FROM
x_kino_movies
WHERE
name = 'Ich bin ein Filmtitel'
LIMIT
1;
column: "name"
unique_id: "sql_filmdaten"
The entity “sensor.xbox_filmtitle” also contains the film title as a value, and is not written any differently than I wrote in the example below.
Am I missing something too obvious?
Thank you for your help!