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.