For as far as I know you cannot update, only read.
There are some exceptions on loading statistics (spook uses this)- but I guess (andunderstand) that HA wants to keep data clean from external influences
What, exactly, is it you are trying to automate, or log to the database? Maybe there’s a more “HA way of doing it” than trying to create and update db tables. HA prefers to handle the database writes itself, and leave the user to interact with entities instead.
Edited to add: it should also be pointed out that, directly modifying the HA database if you don’t know exactly what you are doing, can be a great way to break things. If you absolutely must write to a database, consider using the command-line action to write to a separate database with the sqlite3 command.
I can confirm that writing even a single thing into HA’s sqlite database definitely and immediately corrupts that DB and HA creates a new, blank one (i’ve done that!). In fact, even solely connecting to live HA’s db with third party software causes db to crash, you don’t even need to write into it.
Writing into MariaDB or correcting existing data survives, though (i’ve done that, too).
But, that said, Kami said that he created a new, blank DB, if i understand correct, so he doesn’t want to write into HA db but into that new blank one…
Mainly just messing around. I wanted to have my own table in HA SQL i could reference.
I get a Steps Tracker per day from fitbit Integration.
I was hoping to setup an automation to have the steps saved on a table. Everyday UPDATE steps to steps + (Insert Steps from Fitbit Here) to keep track of total steps.
Maybe track the total per week, month, etc.
I am more comfortable with the SQL Queries, i get alittle confused with the Entities and Helpers.
Thought it would be simple, added a table via SQLLite but hit a wall when i realized i couldnt UPDATE.
As you all mentioned, looks like i am playing with fire haha.
Mainly just messing around. I wanted to have my own table in HA SQL i could reference.
I get a Steps Tracker per day from fitbit Integration.
I was hoping to setup an automation to have the steps saved on a table. Everyday UPDATE steps to steps + (Insert Steps from Fitbit Here) to keep track of total steps.
Maybe track the total per week, month, etc.
I did create a table using SQLLite, but as you all mentioned, i may be playing with fire haha.
Ignoring safety - is there a way to update the table through the text file like you mentioned?
If you have integrated the Fitbit into home assistant already, the the data is probably already being stored or accessible through homeassistant.
I expect that all you need to do to achieve your goal to “track the total per week, month, etc.” is to ensure that the data gets stored in long term statistics (which are retained indefinitely)
I found this link that has additional information on actually getting the Fitbit readings available in HASS
I think your goal should be to get the data into Home Assistant (as sensors) using the above methods and then to make a nice page in the UI that displays your long term statistics