Anyone doing anything with the Firefly III API?

Hey all,

I’m a recent firefly-iii convert (check it out). The project is amazing, but it seems to be lacking in the notification department. I’d really like to pull spending data into HA that way I can do things with it, like send out daily updates, display spending information on the dashboard in my kitchen, and maybe even push bill reminders into my google calendar.

Before I go brute force all of this with RESTful sensors (the firefly API looks amazing), I’m curious if anyone else in the community is doing this already. I can’t find any integrations out there, and I’m not sure I could even cobble one together if I tried.

What is everyone else doing?

1 Like

I was feeling motivated, so I managed to get a dev environment up and running and take a crack at building an integration. But then I realized I have no idea what I’m doing and soon abandoned that idea. Then I thought I’d have a look at creating some rest sensors, but that too fell apart. The API returns a huge pile of JSON that needs to be parsed, and I just don’t have enough jinja skills to pull that off in yaml.

But I was able to cobble something together in node-red that works great! Behold, a flow to query the firefly API for this month’s bills, isolate the ones that are due today, and then send a notification via email (sms) to me and my wife:

Here’s a simplified flow if anyone is interested:

[{"id":"1f3a1059bd1479ba","type":"http request","z":"6b8ad6ee6295894d","name":"Get all bills from firefly","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"bearer","senderr":false,"credentials":{"user":"","password":""},"x":760,"y":720,"wires":[["33a0f9a848696d91"]]},{"id":"c2ef69db5afee699","type":"inject","z":"6b8ad6ee6295894d","name":"Trigger the flow","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 07 * * *","once":false,"onceDelay":0.1,"topic":"Firefly Notification","payload":"","payloadType":"date","x":250,"y":720,"wires":[["640fc9194eb3ebae"]]},{"id":"33a0f9a848696d91","type":"json","z":"6b8ad6ee6295894d","name":"Convert to JSON","property":"payload","action":"","pretty":false,"x":990,"y":720,"wires":[["3993a78ea2f01fed"]]},{"id":"bfccdd5e6ade76b2","type":"split","z":"6b8ad6ee6295894d","name":"Split the data","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":1230,"y":700,"wires":[["504621c5c2725dd4"]]},{"id":"3993a78ea2f01fed","type":"change","z":"6b8ad6ee6295894d","name":"Isolate the data","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":640,"wires":[["bfccdd5e6ade76b2"]]},{"id":"504621c5c2725dd4","type":"switch","z":"6b8ad6ee6295894d","name":"Get today's bills","property":"payload.attributes.next_expected_match_diff","propertyType":"msg","rules":[{"t":"eq","v":"today","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1240,"y":760,"wires":[["2861de390337f1db"]]},{"id":"2861de390337f1db","type":"change","z":"6b8ad6ee6295894d","name":"Format the message","rules":[{"t":"set","p":"payload","pt":"msg","to":"'Hey, your ' & msg.payload.attributes.name & ' bill ($' & msg.payload.attributes.amount_max & ') is due ' & msg.payload.attributes.next_expected_match_diff &\t '!'","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":820,"wires":[["8456c3c65f737dc5"]]},{"id":"640fc9194eb3ebae","type":"moment","z":"6b8ad6ee6295894d","name":"Get today's date","topic":"","input":"payload","inputType":"msg","inTz":"America/Chicago","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD","locale":"C","output":"date.today","outputType":"msg","outTz":"America/Chicago","x":520,"y":680,"wires":[["137bea71ca210685"]]},{"id":"137bea71ca210685","type":"change","z":"6b8ad6ee6295894d","name":"Build the url","rules":[{"t":"set","p":"url","pt":"msg","to":"'https://firefly.yourdomain.com/api/v1/bills?page=1&start=' & $substring(msg.date.today, 0, 8) &\t '01&end=' & msg.date.today","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":740,"wires":[["1f3a1059bd1479ba"]]},{"id":"8456c3c65f737dc5","type":"debug","z":"6b8ad6ee6295894d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1510,"y":720,"wires":[]}]

Next, I may try to look back at all the bills for the month and send a notification if any haven’t been paid. Most are on autopayment, but I have a couple that are not - and I tend to forget to pay them. I’m also going to take a crack at sending a weekend planning notification Friday morning. I want to get notified how much money is left in our discretionary spending categories that way we won’t splurge if we know we don’t have the money.

2 Likes

I have done a similar thing and been pretty pleased with it: GitHub - dvankley/homeassistant-firefly-budget-alert: A node-red flow to pull budget data for recent transactions and send alert notifications via Home Assistant

Step 4 seems to be broken :wink:

Seriously though, thanks for sharing!

Hey @andynbaker I wondered if you added anything else to your flow here? I used your simplified node flow (thank you!) and used it to set up some push notifications to my cell. In addition to @dvk budget flows these really helped me out getting started with node red as im a first time user. it is pretty complex so any other suggested flows or iterations that you did since this post would be welcoming to view.

Also props to dvankley for your plaid connector!

Hello all, don’t know if this topic still is relevant! But I’m on the final steps of developing a fireflyiii integration to Home Assistant, and, if anyone is interested, I’m looking to get a couple of beta testers to help me find bugs and addiconal features that might be missing! If anyone what’s to join in, send me a message so I can provide links to pull the integration for testing!

Thank you

I’m in! Let me know how I can help

Hello @andynbaker I’ll be pushing to github the beta sometime around this week! Then I will provide you with the link to add to your Hacs repos. Tks

I’m interested in this as well

Hello all the first version of the integration is on my github! You can add it to HACS custom repositories as integration and after reboot you can install it on the UI!

Please note that I’ll not be retrofitting configs to versions until its final! So one some releases of beta I’ll add to the release notes a information to delete the integration and add it again. No need to remove from HACS, just remove from Home Assistant and make the config again!

At the moment I have accounts and categories working. Feedbacks are more than welcome, also feature requests. But do it on the github issues, not here!

Please expect bugs, this is a very early Beta!

Thank you all

1 Like

I’m more then happy to test this Addon. Added the Addon now. And see what it do right now