Accessing postgres database from NodeRed #4040
Replies: 1 comment
-
Answering my own question, in case it helps others. I added a postgresql node. In that node, I added a new postgresql server (I named mine teslamate db), and then configured that server as follows:
Then, this is the query I execute:
Oh - the reason I am doing this is so I can track my mileage driven (I'm a handyman) and take that as a tax deduction. Since I drive the Tesla, the IRS rate is pretty favorable, esp. compared to the guys around here that drive F250s as their work vehicle. The next thing I want to be able to do is send a Telegram message like Finally, I am going to need help soon writing a query/creating a dashboard that shows all trips that are to/from a geofence named like 'client *' along with the miles driven and date. |
Beta Was this translation helpful? Give feedback.
-
I've got my teslamate instance updated with the Node-Red addon, and I really like what I can do with it. I have it set up to send telegram notifications out, so I can start interacting in a read-only way with teslamate on my phone. That all works great.
I'd like to add a feature so that when I send a telegram message I can do some simple teslamate commands. I've already implemented a 'status' command that replies with something like:
I'd like to implement a new command
fence (args)
that would add a new geofence namedargs
at the current location with some standard radius and no charge rate. I'm thinking that the easiest way to do this would be to just use a postgres node in my Node Red flow and write directly to the database, but I'm not sure exactly how to configure the node - what hostname do I use? What port, what database name, username and password?Beta Was this translation helpful? Give feedback.
All reactions