home-assistant / home-assistant.io

:blue_book: Home Assistant User documentation
https://www.home-assistant.io
Other
4.96k stars 7.27k forks source link

update documentation for SQL integration about "state of entity X ago" for mariaDB #32198

Closed felixmxr closed 7 months ago

felixmxr commented 7 months ago

Feedback

in the section "state of entity X ago" the SQL code is only valid for mysql installations. the "strftime" function only exists for mysql databases.

for maria db the following should be used SELECT states.state FROM states INNER JOIN states_meta ON states.metadata_id = states_meta.metadata_id WHERE states_meta.entity_id = 'sensor.watermeter_value' AND last_updated_ts <= (UNIX_TIMESTAMP() - 24*3600) ORDER BY last_updated_ts DESC LIMIT 1;

URL

https://www.home-assistant.io/integrations/sql/

Version

2024.4.1

Additional information

No response

home-assistant[bot] commented 7 months ago

Hey there @gjohansson-st, @dougiteixeira, mind taking a look at this feedback as it has been labeled with an integration (sql) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `sql` can trigger bot actions by commenting: - `@home-assistant close` Closes the feedback. - `@home-assistant rename Awesome new title` Renames the feedback. - `@home-assistant reopen` Reopen the feedback. - `@home-assistant unassign sql` Removes the current integration label and assignees on the feedback, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information) to the feedback. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information) on the feedback.
felixmxr commented 7 months ago

pull request

32199

gjohansson-ST commented 7 months ago

Just open a PR next time if you intend to fix it. No need to open an issue first. Thanks 👍