Integration with Minut Point?

Well, for the battery_low the sensor will be ON when fired until the event is no longer present in

  "ongoing_events": [
        "string"
      ]

fetched from GET /devices.

As for more binary_sensors it will be super easy to add more as I only need to extend the dict in L23.

This will be a bit more complicated as it does not follow the normal sensor readings scheme. I’ll have a look at it…

Why not use the battery you get from GET /devices?

Part of my test / play script
`curl -s -H “Authorization: Bearer $MINUTTOKEN” “https://api.minut.com/draft1/devices” | jq -r ‘.devices | map(.description, .battery.percent)’.

Also, for some automation purposes it could be useful to have the time when the last (heartbeat) update was recorded.

Because that is not the way I’ve implemented the sensors…

But, I have another solution. I attach the states to the sensors and you can create a template sensor with battery status.

1 Like

Things are closing in and I hope that the pull-request will get merged pretty soon…

It would be fun if you could test the current implementation and give some feedback (download all files here and add them to custom_components/.

1 Like

Great work! I’m using an earlier version.

Looks like it has been been merged into dev now. Do we know when it might be released?

Btw. Is there something I need to think of when “removing” the custom_components?

Yes, it’s been merged into dev and will be part of 0.83, but I don’t have an expected release date.

There should be very little that you need to do. If you are using the version with Integrations everything should just work. For the other versions you might need to reconfigure. I went from the first version posted and I had to re-authenticate but my old devices kept the device-ids and I got a whole bunch of new sensors :smiley: .

Just followed the instructions but when I try to authenticate, after clicking ‘Accept’ on the Minut website I get a redirect to localhost which fails.
Any chance to tell me what I’m doing wrong?

Yes, when you contacted Minut you did state http://localhost:8000 as redirect_url. It is ok though, you can redo it and take the code (code=TQP..f0 up to but not including &state) and access http://your-home-assistant:8183/api/minut/?code=TQP..f0 (replacing the code and url accordingly).

Sorry about this hassle but it will all get better once oauth2 authentication can be done via the HomeAssistant cloud.

Thanks for the super quick reply!

Unfortunately, I get a 404 error when going to:
https://HASSURL:8123/api/minut/?code=ar6...afe

Are you running the latest 0.83?

Running 0.83.0b1

You must have the dialog in Integrations open to initiate the authentication endpoint.

This is what it looks like for me (using Marcus Test credentials).

And with changed url (note the downloaded file which is the confirmation)

Sorry for this hassle, but atm it is not possible to do it in a nicer way (if you give the right callback url to minut the process will be automatic).

Finally managed! Just had to remove one of the / in the callback!

So when it directed me to: http://localhost:8000/?code=m...F&state=Z...n , I changed it to:
https://hassurl:8123/api/minut?code=m...F&state=Z...n and it suddenly worked!

Unfortunately, only 1 of my 3 points shows up in HA with the new component. With the old custom component they all showed.

2 Likes

Connection went smoothly, but the integration only connects one of the points in my account…

1 Like

That is strange, I’ve written the code to support multiple devices. I only have one myself though so it’s quite hard to debug what might be happening. You don’t see anything interesting in the logs?

I sent an IM with the log entries. ('Config entry has already been setup!' for all but the first point. Is the email used as identifier? Haven’t checked the code but perhaps a typo is omitting the differentiation of the subsequent registrations?)

The new code which fixes this have been merged into the dev branch and I hope it will be part of 0.83.4.

1 Like

The fixes for multiple Points reached 0.84 unfortunatly it introduced another issue (a stupid typo) so the sensors does not load correctly. I’ve submitted a fix for this and will keep you posted when the new version reaches the stable branch.

2 Likes

Hi,

First of all thanks for integrating Minut Point into Home Assistant.

I’ve just configured my Point, and I struggled a bit, just like Sam_Van_Herzele did, so I thought I’ll post exactly what I did to get i working for future reference and aiding other Point users. All credit goes to fredrike, Sam_Van_Herzele, gaffe, and who else posted in this thread.

Step 1: Update configuration.yaml with:
point:
client_id: INSERT ID
client_secret: INSERT SECRET

Step 2: Reboot Home Assistant

Step 3: After the reboot, Home Assistant has discovered your point, start configuring it by following the instructions. Leave the window with Home Assistant open.

Step 4: At some point you’ll be redirected to localhost:8000/point?code=RANDOM_TEXT&state=LONGER_RANDOM_TEXT which fails. BTW, it is by no means random :slight_smile: Do not edit the anything after “code=”, instead replace “localhost:8000/point?” with "https://hassurl:8123/api/minut?". If succeeding, a file is downloaded. Note, it didn’t work in Firefox, I tried in MS Edge which worked perfectly fine.

Step 5: Back in Home Assistant, press “submit” and you are now good to go.

Note: I was using Hassio 0.84.2 when I did this.

4 Likes

Thank you @Jorgensen for writing up this guide.

Are you sure you gave the right URL to Minut when creating the API-keys (you should have given them the url https://hassurl:8123/api/minut, as I tried to explain in the documentation:

To connect Point, you will have to sign up for a developer account and get a client_id and client_secret using the callback url as base_url + /api/minut eg. http://localhost:8123/api/minut . The client_id and client_secret should be used as below.

I really hope that we can get Cloud Authentication but according to @balloob it will take some time.

If the documentation can be made clearer please help and update it.