neilzilla / hass-renpho

Retrieve last weight and timestamp from Renpho app for use in Home Assistant
60 stars 6 forks source link

No Errors But No Data Either #1

Closed tkernaghan closed 2 years ago

tkernaghan commented 2 years ago

Great work figuring this out! I got the custom component installed successfully, the sensor is populated, I'm not getting any errors but I'm not seeing any data either. I waited 10 minutes, as per the refresh time, but still no history on the entity.

It was a little tricky grabbing the password hash. I have an iPhone and ended up buying a cheap app to sniff my password hash, I found what I believe was the password hash from a "Post" to /api/v3/users/sign_in.json with an address of renpho.qnclouds.com. The hash was a very long string of letters and numbers listed in the "Password" field under the "Params" tabs in the sniffing tool I was using.

I put everything into my configurations.yaml file and checked the config for errors. I've rebooted my HA server and confirmed their are no error messages and nothing in the logs except from the expected warning about the custom integration not having been tested.

I'm running core-2021.12.2 on Home Assistant OS 7.0

neilzilla commented 2 years ago

Apologies I'm working at the moment, amazing that you've shown interest as I thought no one would be interested bar me!

For more info on how I obtained the hash, try reading through here if you haven't already, as I produced a write up on it. Link to blog

I'll have a think and reply later on today when I get some free time, apologies in advance as there is no logging or error reporting in the addon as it's the first I've made.

neilzilla commented 2 years ago

I had a thought, the app also only gets any records from the last 3 days - so if you haven't weighed in in that time it won't show.

tkernaghan commented 2 years ago

Hey Thanks for the quick response!

Ya I'm trying to build a HA dashboard for health, I was able to get my steps data from my iphone and wanted my weight data as well. I was looking for a way to export that from my iphone when I came across your integration. I'm actually surprised no one else is using this integration.

I did weigh myself right before I setup the integration just to make sure. I'll have a look at your guide for obtaining the hash and see if I missed a step.

Let me know if there's anything I can do to help you figure out the problem.

tkernaghan commented 2 years ago

I read over the steps you took to get your password hash and I'm 99% sure I took the same steps with the same results.

I used a program called HTTP Catcher on my iPhone to grab my password hash, it cost me a few dollars but had the ability to decrypt HTTPS traffic once root certificates were installed on my iPhone. As I mentioned before my hash was a long string of letters and numbers, uppercase and lower case and ended with an equal sign like you described in your blog post.

One thing I noticed that I forgot to mention was that I am getting logged out of the Renpho app on my phone. I think your mentioned at one point that this would happen. This makes me think the authentication process is working but the data "pull" fails?

neilzilla commented 2 years ago

The fact you're getting logged out is promising! I believe it only allows one session at a time hence it logs you out of the app when Home Assistant logs in.

I haven't used HTTP Catcher but it sounds like an easier route than the one I took! I learned a lot though! It sounds like you got the hash fine.

There are a number of things that could result in data not being pulled, as I said I wrote it for my specific use case so it only expects to find one user and one measurement device, if you have more than one of each it could be looking for the wrong data in the wrong place.

How many users are on the Renpho Account and how many devices attached? I could have a look into adding some config for this when I get some free time if need be!

tkernaghan commented 2 years ago

My setup should be fairly straight forward, I only have one user and one device. My one device is a smart scale and is listed as an ES-20M in the Renpho app.

neilzilla commented 2 years ago

Are you in a position to run some python test scripts to help figure out the issue?

tkernaghan commented 2 years ago

Yes potentially, maybe with some guidance needed, I'm an IT professional but relatively new to Home Assistant and I don't know much about programming.

masteryodha commented 2 years ago

I'm a complete noobie with home assistant integration. I just fork your repo and made some adjusments :

I've tested it like 10 seconds, so there may be bugs and it's not super clean. You can check this out if you want : https://github.com/masteryodha/hass-renpho

When i get time to test it out correctly I might do a PR for you

neilzilla commented 2 years ago

was just about to recommend this @masteryodha I don't have much time to work on this at present, so might be best looking at @masteryodha 's fork @tkernaghan .

neilzilla commented 2 years ago

@tkernaghan I've added some very basic error reporting, but it might be enough that if you update the component (would recommend deleting old folder and copying in new one) and check logs it should give us an idea of what's going on.

neilzilla commented 2 years ago

Closing as it's been a month with no activity