snoo icon indicating copy to clipboard operation
snoo copied to clipboard

PubNub API support?

Open tlrobinson opened this issue 5 years ago β€’ 6 comments

Thanks for creating this. Just wondering if you had any plans to support the PubNub API in order to control the Snoo?

I briefly started looking into it. It's possible to intercept the requests to PubNub (https://ps.pndsn.com) with something like mitmproxy. The commands look simple enough, I verified something like this works:

curl -v -X POST \
  "https://ps.pndsn.com/publish/pub-c-<UUID>/sub-c-<UUID>/0/ControlCommand.<NUMBER>/0?auth=<JWT>" \
  -H "Content-Type: application/json" \
  --data-binary '{"command": "go_to_state","hold": "off","state": "WEANING_BASELINE"}'

Of course the tricky part is figuring out where those UUIDs come from and signing the JWT.

tlrobinson avatar Feb 07 '20 05:02 tlrobinson

Hey @tlrobinson, thanks for using it! I'm not planning on including PubNub support myself (mostly because my tiny human is now 6 months old and out of the snoo), but if you want to have a go at it and create a PR I'd love to include it!

maebert avatar Apr 13 '20 18:04 maebert

Hey @tlrobinson! Do you have the pubnub code lying around? My 1mo kid is squirming more than snoo can handle. I want to write a simple Pebble app that shows status and buttons to adjust rocking. Yes it's 5am πŸ˜‰

ericmigi avatar Nov 21 '20 13:11 ericmigi

Hey Eric! Unfortunately I never got it working, sorry!

I am also awake on account of my little one. Unfortunately they don’t make a Snoo for 1 year olds ;)

Congratulations and good luck!

On Sat, Nov 21, 2020 at 5:55 AM Eric Migicovsky [email protected] wrote:

Hey @tlrobinson https://github.com/tlrobinson! Do you have the pubnub code lying around? My 1mo kid is squirming more than snoo can handle. I want to write a simple Pebble app that shows status and buttons to adjust rocking. Yes it's 5am πŸ˜‰

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/maebert/snoo/issues/3#issuecomment-731582915, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEOEM4LW4FSAGGS3MN2LDSQ7BGXANCNFSM4KRI4U2A .

tlrobinson avatar Nov 21 '20 14:11 tlrobinson

@tlrobinson how were you able to get the uuid and create the jwt (any specific claims?). Do you have any resources so I could potentially look into this further.

niemyjski avatar Feb 01 '21 12:02 niemyjski

Hey everyone, just FYI, since I'm a recent dad I actually implemented a similar project with pubnub support: https://github.com/rado0x54/pysnoo Happy to get some feedback! I needed a library with pubnub support because I'm writing a home-assistant integration as well and a PubSub model is cleaner to a polling-based solution.

rado0x54 avatar Feb 13 '21 18:02 rado0x54

@rado0x54 did you ever get the HASS integration done? About to get a snoo and would love to be able to control it from HASS.

FuzzyMistborn avatar May 19 '21 14:05 FuzzyMistborn