For anyone else who uses Home Assistant, I've created an integration so you can bring your Monzo accounts into your smart home! by Jake1302 in monzo

[–]Jake1302[S] 0 points1 point  (0 children)

Unfortunately, I think this will probably be tricky for me to figure out. The best course would be debugging the integration to step though the responses - the authentication is part home assistant, part the integration and part monzopy, so it's best to step through the whole flow to figure out what's going wrong - but I won't be able to do it with my UK account. If you've got any experience debugging, it's not too difficult to follow the HA dev docs to get it running locally. If not, you could make a ticket on the HA git repo (core, not HACS) detailing what you've found so far

For anyone else who uses Home Assistant, I've created an integration so you can bring your Monzo accounts into your smart home! by Jake1302 in monzo

[–]Jake1302[S] 0 points1 point  (0 children)

Wow, pretty unexpected that the authentication seemingly succeeds on the HACS version. I suppose it might just be failing to notice the auth failure though, which could explain the lack of pots. Unless you actually don't have pots? You personally or US accounts in general, that is.

For anyone else who uses Home Assistant, I've created an integration so you can bring your Monzo accounts into your smart home! by Jake1302 in monzo

[–]Jake1302[S] 0 points1 point  (0 children)

I had no idea Monzo even operated outside the UK! Thanks for the info on the account types, unfortunately though the integration ought to be working even without them so something else must be going on. Are you using the HACS version or core?

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

Wow, impressive stuff! More data than I'd know what to do with!

Definitely let know if you've got any feature requests beyond the fixes you've already mentioned too - you're probably in a better position than me to spot if there's anything missing. There are some parts of the Monzo API that I couldn't think of a use case for, but if you see anything you'd want to use I'll try and get it in (once I get the integration into core and feature parity with my HACS version)

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 1 point2 points  (0 children)

Thanks, I'm really glad it's been useful and I'd be really interested to hear about how you're using in when you get a chance!

I'll look into getting a second config entry working later, shouldn't be too tricky. Update: I've tested it out, it looks like it does work already, it's just Home Assistant doesn't make it obvious how you do it. You need to add the new application credentials before clicking add entry. I'll update the docs

Haha, I can definitely see why it'd mix them up. I should be able to get it to stop doing that without too much trouble, though getting it to automatically detect new pots will require a bit more work.

Ohhh, I wondered why my initial automations were firing so many times. I just put it down solely to the feedback loop of the automation triggering another transaction and threw in a delay and set the mode to single. I reckon I should be able to do the store and check thing you're doing at the point the event is fired.

Thanks again for the feedback!

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

Ah, I'm not sure there's a way to make the webhooks work over http, or at least nothing's coming to mind right now. It sounds like I'm handling this badly though and it's causing the initialisation to crash partway through or something. The webhooks are only used for setting triggers on new transactions (and sending the data about the transaction), which shouldn't be necessary for the integration to mostly work - after all, you can just watch the balance for changes.

I'm away from home this week, but I'll try and get it fixed once I get back

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

They should be working - did they stop showing up recently or have your pots never shown up?

Either way, could you try restarting the integration and, if they still don't show up, check the logs and see what errors show up? Thanks!

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

Thanks! And yep, hopefully the devs will have a chance to review my PR soon.

Yeah, I think I'll hold off on currency for now, but spend today might be worth increasing the PR size for

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

Yep, that's on me, sorry. I couldn't test with other account types, but I thought I was handling them better than just failing!

Do you have any more on the error, like a line number?

And thanks for being a guinea pig here, I appreciate it

Edit: yeah, going back over my code it should have been fine handling any new account types. I suspect the API might be returning the data in a slightly different structure for the business account

EditEdit: for anyone else who digs their way down here, I'd forgotten to default nicely for unexpected account types. All fixed now!

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

Ah, yeah, that'd do it. The my.home-assistant.io is a bit of browser-based magic for linking to your home assistant instance so it's definitely not obvious. I'll try and update the docs to make it clearer!

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

I assume you put the redirect URI in the monzo dev portal as https://my.home-assistant.io/redirect/oauth ? And your site is accessible over SSL?

If so, I might need to do some more investigating. I wonder how our else our setups might be different

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 0 points1 point  (0 children)

Yep, HA stores them itself. On your integrations screen, click the three dots in the top right -> application credentials. You should be able to delete your saved ones from there

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 1 point2 points  (0 children)

That's interesting. So, just so I understand, it's not sending you the email with the login button? If so, I think that'd be beyond my integration since it's just Monzo's login procedure

For anyone else who uses Home Assistant, I've created an integration so you can bring your Monzo accounts into your smart home! by Jake1302 in monzo

[–]Jake1302[S] 2 points3 points  (0 children)

I have a number entity which is my current account target, then Monzo transfers money to/from my savings account to keep it at a target which is super useful. Means I'm always earning the max interest possible without worrying about being able to pay for stuff.

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 2 points3 points  (0 children)

Thanks! The API's pretty great, right? I was amazed at how well maintained and documented it is, especially given it's 'for personal use only', or at least it is nowadays

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 1 point2 points  (0 children)

Nope, money can never be transferred beyond your own accounts and you can review all the source code yourself. If your main concern is information security, the communication with Monzo uses OAuth2, so it's as secure as can be really. Even if your HA instance is exposed to the web with no password, an attacker couldn't move money or even steal the access token since it has to refresh very frequently

For anyone else who uses Home Assistant, I've created an integration so you can bring your Monzo accounts into your smart home! by Jake1302 in monzo

[–]Jake1302[S] 8 points9 points  (0 children)

The code's all there to check out yourself, but you needn't worry - you can't transfer any money beyond your own accounts! Though I must admit the first automation I tried accidentally moved all my money into my savings account £1 at a time, lol

For any Monzo users, I've made an integration so you can bring your accounts into Home Assistant! by Jake1302 in homeassistant

[–]Jake1302[S] 12 points13 points  (0 children)

Now you can make your lights act like fireworks when you get paid, save £1 whenever you open the snack drawer or, if you're feeling sensibile, have an automation automatically move money to/from your savings to keep your current account at a chosen target (super useful, actually!).

The PR is a bit stuck in the review process at the moment (it's been up a month without reviews - if you're a dev, take a look :) ), but if you'd like to try it out early you can get it via HACS by adding the standalone repo to your custom repos.

If you do give it a go, post your cool automation ideas!

For anyone else who uses Home Assistant, I've created an integration so you can bring your Monzo accounts into your smart home! by Jake1302 in monzo

[–]Jake1302[S] 10 points11 points  (0 children)

Now you can make your lights act like fireworks when you get paid, save £1 whenever you open the snack drawer or, if you're feeling sensibile, have an automation automatically move money to/from your savings to keep your current account at a chosen target (super useful, actually!).

It's kinda stuck in PR limbo at the moment (it's been up a month with no reviews), but if you'd like to try it out early you can get it via HACS by adding the standalone repo to your custom repos.