I already wrote the next debugging step above: Philips Airfryer & NutriU Integration (Alexa only)? - #49 by nicohirsch
Please don’t let me do everything for you. I’d rather use that time to make the script better for everyone.
Today I reworked the code quite a bit:
- Reordered and added some new settings
- Listed all the available services
- Created descriptions and selectors for all services
- Added new services (Adjust Time, Adjust Temp)
- Optimized existing services
- Optimized the frontend card to be usable if you don’t have Airspeed or Temp Probe
- Additionally I added the guide how to get the secrets to the Gist
Since English is obviously not my native language, I would be happy if you let me know if you find anything wrong or misleading in the descriptions (preferably by DM to avoid further spamming the thread here)
I think I fixed the crashing issue by making sure, that no two services are running in parallel. In the past it was possible to call a service like “airfryer_start_cooking” while in the background the sensors get updated. Now, depending on who’s first, either your service_call (for example “airfryer_start_cooking”) gets delayed a little bit or the sensor update is skipped once.
I also moved the code from Github Gists to a new repository:
For everybody who is trying to get their API Key and can’t succeed.
I use a debugging Proxy - like Charles - to record all the traffic between the NutriU App on my phone and the servers. You need to turn on SSL proxy and force-quite the app before, so that it’s logging in again to the server. During this process the app get the API Key for your Airfryer.
As I mentioned earlier in a post, I tried to mimic the login process in order to receive the API key outside of the app, but I got stuck there. Maybe someone has the time to further dig into it.
My integration with Airfryer HD9285 stopped working in HA so I started investigating. I wasn’t able to call the endpoints from Postman using valid Authorization header so I turned on the VM to double check if my client id/secret are valid. I discovered that my client secret has changed! I am suspecting that this might have happened when I enabled remote control in the app on my phone. There are also some other changes in the database. So keep an eye for this, maybe you will confirm when can the secret change.
After updating the secret in HA it works again
For my HD9285 I needed this configuration
pyscript:
allow_all_imports: true
apps:
airfryer:
airfryer_ip: "192.168.1.78"
client_id: "XXXXXXXXXXXXXXXXXXX"
client_secret: "XXXXXXXXXXXXXXXXXXX"
time_total: "time"
time_remaining: "cur_time"
replace_timestamp: True
I wrote a cloud implementation for nutriu for ioBroker maybe someone can test it.
I have still some issue with the mqtt cloud connection
But I can easily read client id and secret maybe I can join the local connection
i have air fryer HD928X and with your configuration don’t work, I have a client id and client secret, the integration generate a token but no value from sensor, if I try with a curl request using token generator for the integration I receive 401 response.
Thanks for the warning! I can’t test it at the moment, but I have at least written a note in the “guide”.
I have marked the sensors as working for the model number in the README. If you have the possibility to analyze the traffic of the app, then we can also check the service_calls (what does the app send to the airfryer when you start the connection; setup, start, pause, stop cooking). I think at least a few of them don’t work the same way as on my model.
That looks great! I don’t use ioBroker and don’t know if I’ll get around to setting up a test instance yet. But if you have any questions about the local connection, feel free to send me a DM - maybe I can help.
401 means “unauthorized”. So I think there’s a problem with you client_id / client_secret. You should check them again - either there’s a typo or maybe they have changed for you too.
i have retry to obtain client secret and client id and now everything work with my Airfryer HD928X
Thanks
Finally I was able to set it up. I also want to make use of the card provided on GitHub but I get an error I don’t know where it comes from and how to fix:
When I click and hold the card:
Any ideas?
Edit: Fixed it partially. line 104 of the card should state “None” iso “none”. Now I only have an issue with the color. If I change color #fffff to #000000 I can see everything’
Good that you managed to set everything up. The frontend card was made for dark mode - when I get the chance, I’ll see if I can change the text color to the theme variable. Then the card should also work in light mode.
You might want to change “#FFF2” to “#0002” in the lines 36 & 37, so that you can also see the background of the progress bar.
Edit: Fixed it partially. line 104 of the card should state “None” iso “none”.
Does your pyscript.airfryer_dialog
report “None” instead of “none” when the Airfryer is on and no dialog is open? What model do you have?
Thanks. Indeed now I get an error with “None” which is gone when I change to “none”. strange… I have the HD9280/91
Maybe a tip to get everything set up via Android x86: I installed Firefox as default browser as I was not able to update Chrome. With Firefox the authentication process worked where with Chrome I ended up with a blank webpage.
it’s normal that now nutria apps don’t work? if I try to connect another device with nutriu home assistant stop to work and If I connect another device the previous device stop to work.
there is limit to use only 1 device at time?
I can use HA & NutriU in parallel. However, I also have a larger/more expensive model. It may well be that the “cheaper” models are limited to one connection at a time.
Can you try adding another device, but that device being Android VM or rooted Android device, so that you can access the SQLite database? I am wondering if maybe the client secret changes when you add a new device. In such case, NutriU apps could continue working as those would be able to refresh the secret, while HA integration would become permanently broken.
i have retried with an ANDROID x86 and continue to WORK but the client id and client secret is changed, and my iPad my iPhone stop to work, the iPad of my wife continue to work… it’s very strange
i have removed Nutriu from all my apple device and reinstalled, and all works well, both home assistant and apple device works togheter