DeeeeLAN / homebridge-sleepiq

SleepIQ Homebridge plugin
18 stars 10 forks source link

[Feature Request] Light controls #3

Closed dppeak closed 3 years ago

dppeak commented 5 years ago

Is it possible to access the Nightlight and or Nightstand accessories?

DeeeeLAN commented 5 years ago

Can they be controlled through the app?

dppeak commented 5 years ago

Yes. As well as the massage unit.

DeeeeLAN commented 5 years ago

Then yes, we can add them as options, but I will need your help because I don’t have the base, so I can’t get the data from the API. It is a multi step process requiring you to connect your phone to Charles proxy and get the necessary API data I need, then it is trivial to get it added.

dppeak commented 5 years ago

great. I have Charles on my work laptop. What's the host I'm looking for?

DeeeeLAN commented 5 years ago

*sleepiq* is what you want to add to the SSL whitelist. Make sure your app is set to cloud mode and you have added the SSL certificate to your phone, and set it to be a root certificate (Charles has guides on how to do this). Once that is set up, control everything to do with the lights and massage unit (and do you have a foot warmer too?), and send a screenshot of the interface along with the data so I have context. You can double check the sleepiq data before sending it to verify it is unencrypted.

dppeak commented 5 years ago

What is your email where I can send the Charles file and screenshots? I turned lights on and off and same with the massage. We also have the Flex Fit base and I've captured that screen and activated the 6th preset (Read or preset 5 in charles -- 0 index array)

There are 4 outlets for lights. Ids 1 & 2 are for the normal plugs which you can use for "Nightstand" lights. Ids 3 & 4 are for the "Nightlights" under the bed (LED strips).

In our setup, 2 & 4 are left side while 1 & 3 are right.

DeeeeLAN commented 5 years ago

What is your base model? Also, what is the output of the bed() API call? You might be able to find it in Charles as well if you do a cold start in the app.

dppeak commented 5 years ago

@DeeeeLAN The bed feed says it's the FlexFit 3, however we don't have the foot warming option. That may have been added as a feature since we purchased ours back in 2016. I sent you the JSON feed last week via email (11th?). I'll have to check on my work laptop to check for the file.

DeeeeLAN commented 5 years ago

The data you sent me didn't have it. It only shows up right when the app is started, so if you started collecting after that, you probably missed it. Sorry, I missed your follow-up email somehow.

I am trying to figure out how to auto configure the available devices according to what base you have, but it might not be possible if the API doesn't give me any significant info. If I can't find anything, I will probably have to have options in the config that allow you to turn on or off each device. That might be a better option anyway - that way if there is something somebody doesn't care about, they can just hide it, and it will let me handle hardware generation issues such as a flex fit 3 with no foot heaters 😁.

dppeak commented 4 years ago

@DeeeeLAN

Here is the response for the (GET) /rest/bed/:bedId/foundation/outlet?_k={{key}}&outletId=1

{ "bedId": "", "outlet": 3, "setting": 0, "timer": null }

Here is the (PUT) /rest/bed/:bedId/foundation/outlet?_k={{key}}

JSON Body to turn outlet 1 off { "outletId": 1, "setting": 0 }

JSON Body to turn outlet 1 on { "outletId": 1, "setting": 1 }

dppeak commented 4 years ago

This link looks useful to help determining the available foundation features.

https://github.com/technicalpickles/sleepyq/blob/master/sleepyq/__init__.py

DeeeeLAN commented 3 years ago

I just published initial support for controller outlets and light strips, but of course it is completely untested since I don't have a bed with the features, so please let me know if there are any issues. Open a new ticket if there are any bugs, and if you can open a feature request ticket for the massage unit that includes the REST data, that would be awesome.