Closed GreysenPaige closed 1 year ago
Would you start homebridge in debug mode and post your output? I need to see how I can differentiate between devices since I only have the air mini to test on.
FYI @csirikak, "Grey's Room" is an Air Pro. "Blue's Room" is an Air Mini+.
@csirikak just checking in on this? Can I delete my comments with my logs given the sensitive information they may contain?
Hey there, checking in to see if you’ll be able to fix this? I just ordered 3 more Molekules. So I really really need this. Thanks!
Hey there, just checking in on this again. Do you think you’ll be able to update this soon? It would mean a lot if you could.
@GreysenPaige I have a working fork here. And an npm package published alongside until I can get some time to turn this into a PR. I went a little heavy and tried to make things more ergonomic for my use, consequently I don't think it is in the spirit of the original maintainers architecture in present form. The important discoveries I made after reverse engineering the iOS app with Proxyman are thus:
1
,2
, and 3
(33%,66%,100% respective to the value of the "fan speed" shown in the home app)2
means 'Auto' mode which will graduate between silent and turbo state based on addl. sensor input@csirikak Would you welcome a refactor from me on these points?:
Class
s as possibleutils.js
@GreysenPaige I have a working fork here. And an npm package published alongside until I can get some time to turn this into a PR. I went a little heavy and tried to make things more ergonomic for my use, consequently I don't think it is in the spirit of the original maintainers architecture in present form. The important discoveries I made after reverse engineering the iOS app with Proxyman are thus:
- Fan speeds observed were
1
,2
, and3
(33%,66%,100% respective to the value of the "fan speed" shown in the home app)2
means 'Auto' mode which will graduate between silent and turbo state based on addl. sensor inputAdded in my fork:
- Adjusting the fan speed will now automatically 'clamp' to the proper threshold. ie. User inputs 42%, value is automatically transformed to its nearest clamp value 33%.
- The 'Auto' toggle now sets the fan speed to 66%.
- Setting the fan speed to 66% will also enable 'Auto' mode in the home app.
- Setting any other speed will disable the 'Auto' mode flag
Thank you for working on this! I tried this last night when I saw it in search. Unfortunately it didn't work with my Air Pro at all. The fan speed wouldn't effectively change seemingly at all. It seemed like it was just stuck on 3 out of 6 in manual control.
@GreysenPaige I don't have a pro maybe you could download Proxyman and follow the steps to install the CA cert on your phone so you can inspect the molekule traffic? I can roll out a fix once I understand what commands its attempting to send. A HAR archive of the requests would be awesomesauce for the whole community to see for future ref, too.
@csirikak Would you welcome a refactor from me on these points?:
- Reformat with prettier
- Use fetch where possible
- Use as little
Class
s as possible- Break reusable code blocks into a
utils.js
- Dry up the important bits so extension is more ergonmic
A PR focused on a refactor would be welcome!
When you say ergonomic do you refer to the ability to flexibly implement the functions across different products with varying parameters?
Having working setSpeed
and handleAutoSet
functions that work across all of Molekule's devices unfortunately will require lots of reverse engineering since the speed range and auto functionality differ significantly between them.
I only own a Molekule Air Mini so I can't personally test functionality between other devices so I'm very welcome to pull requests that add support for new devices and features such as the reporting of AQI, or simple bug fixes.
@csirikak Ergonomics/refactors to common utils, might have just said the same thing twice here - it was a late night post for me. And yeah I'm hoping to get some Proxyman data for the pro so that those work well.
I just have a Molekule v1 so let me know if there is something different with the mini's fanSpeed requests and I can include that in my PR. Unless its the same then awesome.
@mpash I have a PRO, happy to assist in any way to get you the info you need to see if we get the Pro to play nicely.
@mpash I have a PRO, happy to assist in any way to get you the info you need to see if we get the Pro to play nicely.
Would you please open the molekule app and set the speed, the auto/manual function and log the requests to the Proxyman app?
Essentially, I need to add a function to identify the device model and set the available fan speeds and auto capability. Also, homekit includes a mechanism for reporting air quality so I'd like details on the API function.
@mpash I have a PRO, happy to assist in any way to get you the info you need to see if we get the Pro to play nicely.
Would you please open the molekule app and set the speed, the auto/manual function and log the requests to the Proxyman app?
Essentially, I need to add a function to identify the device model and set the available fan speeds and auto capability. Also, homekit includes a mechanism for reporting air quality so I'd like details on the API function.
Forgive my ignorance, but will need my hand held a little here.
I downloaded the Proxyman app on my phone, configured the VPN and signed cert, all looks good there.
Just need to be walked through how to generate the logs.
Almost there now just need to use the app and inspect the logs. Look for the Molekule host and what API calls it tries to make. You might get an SSL error on first connect but clicking through should start to capture those events we need. I'll grab some pics for reference of what I did
@mpash Hoping the attached are the logs you need. If not, I might need some specific direction.
We have an Air Mini+ and Air Pro. Here are some screenshots of their options. Which are different than the original Air Mini.
Air Pro Air Mini+
I made sure to navigate through all options, hoping to log them.
api.molekule.com_09-01-2023-15-05-27.proxymanlogv2.zip
Let me know what you have this, and I'll remove.
Thats perfect! You should also change your molekule password quickly so that no one can use this token to impersonate your user. Another thing this exposes is your serial, just FYI but I imagine we can take down the archive once we get this fix up.
curl 'https://api.molekule.com/users/me/devices/MN2M-PEA201002-000043/actions/set-fan-speed' \
-X POST \
-H 'Host: api.molekule.com' \
-H 'X-Api-Version: 1.0' \
-H 'Connection: keep-alive' \
-H 'Accept: application/json' \
-H 'User-Agent: Molekule/5.2.1 (com.molekule.ios; build:1342; iOS 17.0.0) Alamofire/4.9.1' \
-H 'Authorization:REDACTED' \
-H 'Accept-Language: en-US;q=1.0' \
-H 'Content-Type: application/json' \
--data-raw '{"fanSpeed":1}' \
--proxy http://localhost:9090
Some first glance notes:
serial
at first glance{fanSpeed: 1}
and expect a 202https://api.molekule.com/stats/event-type
https://api.molekule.com/users/me/devices/set-burst-mode
@mpash password changed. Let me know if I can provide anything else, or test any new builds. I know you're enhancing a plugin for devices you don't have, so happy to Venmo you some money, as this would be greatly appreciated.
@mpash After changing my password, the plugin is giving me an authentication error. Any remedies you know about?
@mpash After changing my password, the plugin is giving me an authentication error. Any remedies you know about?
Does it say something like:
UserLambdaValidationException: PreAuthentication failed with error 2023-09-02T01:05:47.806Z 63b36396-1fb8-4ab4-a39d-2c3a3ae8c046 Task timed out after 3.57 seconds. at C:\Users\n_j\code\homebridge-molekule\node_modules\amazon-cognito-identity-js\lib\Client.js:153:19 at processTicksAndRejections (node:internal/process/task_queues:96:5) { code: 'UserLambdaValidationException' }
I have a test branch with the latest changes, can you confirm with your devices if everything works ok?
@QandnotU
`[9/1/2023, 7:10:49 PM] [homebridge-molekule] API Authentication Failure, possibly a password/username error. [9/1/2023, 7:10:49 PM] [homebridge-molekule] PasswordResetRequiredException: Password reset required for the user at /usr/local/lib/node_modules/@mpash/homebridge-molekule/node_modules/amazon-cognito-identity-js/lib/Client.js:129:19 at processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'PasswordResetRequiredException' }
It says you need to reset your password again, I'm not sure why.
I'm on 1.2.4 assuming this is the latest test branch? If so, I'm on the latest but can't get the devices back into HomeKit due to the error above.
1.2.4 is @mpash's version. I'll make sure to bump the version to 1.3.0-alpha so that it's clear.
To test the new version you'd have to run
npm install -g homebridge-molekule@alpha
I'm on 1.3.0. Unfortunately Molekule hasn't figured how to develop a proper password reset. So waiting for them to reply to my support ticket. Hopefully I'll have a link in the morning and I'll give it a go when I'm back in the office tomorrow. Thank you.
@csirikak the fan speeds are working great, I'm able to choose between 1-6 on the Air Pro, and 1-5 on the Mini+.
When restarting HomeBridge, I did see this, but it doesn't seem to effect functionality.
[9/2/2023, 10:25:54 AM] [homebridge-molekule] Adding new accessory: Bathroom [Bathroom@@Filter Change Indication] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Bathroom@@Filter Life Level] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Bathroom@@Air Quality] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [9/2/2023, 10:25:54 AM] [homebridge-molekule] Adding new accessory: Lounge [Lounge@@Filter Change Indication] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Lounge@@Filter Life Level] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Lounge@@Air Quality] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway.
In the details of the accessory in the home app, it does read "Air Quality: Unknown". - Not sure if this is something made available to you in their API, so that might be the reason its missing.
I'm unable to switch between manual and auto mode in the Home app, it seems to revert back to the previous state.
@csirikak the fan speeds are working great, I'm able to choose between 1-6 on the Air Pro, and 1-5 on the Mini+.
When restarting HomeBridge, I did see this, but it doesn't seem to effect functionality.
[9/2/2023, 10:25:54 AM] [homebridge-molekule] Adding new accessory: Bathroom [Bathroom@@Filter Change Indication] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Bathroom@@Filter Life Level] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Bathroom@@Air Quality] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [9/2/2023, 10:25:54 AM] [homebridge-molekule] Adding new accessory: Lounge [Lounge@@Filter Change Indication] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Lounge@@Filter Life Level] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway. [Lounge@@Air Quality] Characteristic not in required or optional characteristic section for service AirPurifier. Adding anyway.
This is an optional characteristic for air purifiers in the homekit API but homebridge doesn't seem to think so. It can be ignored.
In the details of the accessory in the home app, it does read "Air Quality: Unknown". - Not sure if this is something made available to you in their API, so that might be the reason it's missing.
I'm unable to switch between manual and auto mode in the Home app, it seems to revert back to the previous state.
please try this version : npm i homebridge-molekule@1.3.1-alpha
@csirikak Air quality is showing for me now. Last bit and I think we have a pretty solid plugin, is the Auto/Manual mode. Also, do you have Venmo, Zelle, or PayPal?
@csirikak Air quality is showing for me now. Last bit and I think we have a pretty solid plugin, is the Auto/Manual mode. Also, do you have Venmo, Zelle, or PayPal?
Don't worry about paying, you're just as needed since you're the one with the devices and testing the versions.
npm i homebridge-molekule@1.3.3-alpha
caller
of class HttpAjax
used to have a separate instance for every accessory as well as the base platform, now uses only a single incarnation. Should improve responsiveness.@csirikak Air quality now shows as an additional accessory. I'm doing this remote, I'll handle the other issue when I get into the office in an hour or so.
Auto/Manual The Air Pro has a Quiet and Standard Auto mode. When moving from Manual to Auto, it does change to Auto, but puts the device in Quiet mode. When I go back to Manual in the home app, the devices moves to Standard Auto mode, not into Manual.
The Mini+, is unchanged, setting Auto or Manual isn't registering on the device.
Please try npm i homebridge-molekule@1.3.4-alpha
enable-smart-mode
receives a JSON input containing a silent key and value when the device is an Air Pro, otherwise, it should be empty.AirQualitySensor
service, and allowing non optional or required characteristics to be part of the AirPurifier
service.If everything looks good, I'll make this new version the official release version.
@csirikak getting the following when switching modes.
Auto to Manual
[9/2/2023, 4:22:01 PM] [homebridge-molekule] Homekit attempted to set auto/manual (0) state but your device doesn't support it ☹ [9/2/2023, 4:22:01 PM] [homebridge-molekule] Lounge failed to set auto/manual state
Manual to Auto
[9/2/2023, 4:28:33 PM] [homebridge-molekule] Homekit attempted to set auto/manual (1) state but your device doesn't support it ☹ [9/2/2023, 4:28:33 PM] [homebridge-molekule] Lounge failed to set auto/manual state
@csirikak getting the following when switching modes.
Auto to Manual
[9/2/2023, 4:22:01 PM] [homebridge-molekule] Homekit attempted to set auto/manual (0) state but your device doesn't support it ☹ [9/2/2023, 4:22:01 PM] [homebridge-molekule] Lounge failed to set auto/manual state
Manual to Auto
[9/2/2023, 4:28:33 PM] [homebridge-molekule] Homekit attempted to set auto/manual (1) state but your device doesn't support it ☹ [9/2/2023, 4:28:33 PM] [homebridge-molekule] Lounge failed to set auto/manual state
new version npm i homebridge-molekule@1.3.5-alpha
updateStates()
is called.@csirikak not seeing 1.3.5 in alternative versions.
@csirikak not seeing 1.3.5 in alternative versions.
I apologize, the new version should be available now.
@csirikak thank you. Still getting the same auto/manual error above on 1.3.5.
@csirikak thank you. Still getting the same auto/manual error above on 1.3.5.
Does auto/manual functionality work in your bathroom unit? I'm having trouble understanding what's happening without being able to test and see the runtime variables myself.
I assume that the AutoFunctionality
from devices.json
isn't being properly passed but if the bathroom unit works then I'd need to find a way to test it.
@csirikak they both throw the same error.
Try clearing out the device cache, the device properties are stored only when the accessory is registered.
I changed the values in devices.json
and they weren't conveyed because they only are set during initial configuration. Next version will fix this.
Try clearing out the device cache, the device properties are stored only when the accessory is registered.
Mini+ Auto to Manual working Manual to Auto working
Air Pro
Auto to Manual working
Manual to Auto - Error Lounge failed to set auto/manual state
Air Quality no longer showing as a separate accessory.
Try clearing out the device cache, the device properties are stored only when the accessory is registered.
Mini+ Auto to Manual working Manual to Auto working
Air Pro Auto to Manual working Manual to Auto - Error
Lounge failed to set auto/manual state
Air Quality no longer showing as a separate accessory.
I think it's because I didn't check for the undefined condition if in the config silentAuto
isn't present
Try adding silentAuto
into the config, it's a boolean for the Air Pro to choose default auto state.
Next version will fix this also.
1.3.6
Air Pro still experiencing an error when switching from Manual to Auto.
1.3.6
Air Pro still experiencing an error when switching from Manual to Auto.
can you post your cachedAccessories file? in .homebridge/accessories?
@csirikak
What is the last HTTP POST code you're getting in the homebridge log when you set the auto state?
[9/5/2023, 11:30:09 AM] [homebridge-molekule] HTTP POST STATUS: 400 With contents: {"silent": "false"} [9/5/2023, 11:30:09 AM] [homebridge-molekule] Lounge failed to set auto/manual state
[9/5/2023, 11:30:09 AM] [homebridge-molekule] HTTP POST STATUS: 400 With contents: {"silent": "false"} [9/5/2023, 11:30:09 AM] [homebridge-molekule] Lounge failed to set auto/manual state
Please try version 1.3.7
That did it, things are good on both purifiers!
If I use the home app or Siri to set Molekule speed to 100%, it only sets it to setting 5 out of 6. I always set it to 100% when I sleep to drown out noise, and I notice a definite lower volume at 5. Can you please update this to support 100% fan speed on Molekule Air Pro?