DeeeeLAN / homebridge-sleepiq

SleepIQ Homebridge plugin
18 stars 10 forks source link

Feature Request: Bed Positions and/or Position Presets #5

Closed 64Spaces closed 5 years ago

64Spaces commented 5 years ago

Thanks for working on this plug-in. I'm currently using 2.04 for occupancy and sleep number. I had previously sent you the Charles data and information on my base. The last version I tried was 3.2.1 and it did not work. Do you think the new version will recognize the bed positions? If yes, I will give the new version a try as soon as I can, but I need to setup a separate instance of Homebridge. Thanks again

DeeeeLAN commented 5 years ago

There have been a lot of changes since 3.2.1, I think it would be best to try it out and work from there with fresh logs. I am sure it still doesn't work, because I haven't done anything with it, but it will give us a better starting point.

The easiest way to set up a new instance is to make a copy of your ~/.homebridge directory, and change the port in the config of it. Then you can launch homebridge using that new directory.

As I mentioned on a different issue- there are enough versions of the bases (even year to year) that it might not be possible to auto set up the various features available with each bed. Everything would need to be manually enabled from the homebridge-sleepiq config. That is minor, but I will try and do auto config first.

64Spaces commented 5 years ago

This should be left side and right side. How would I go about getting you more information?

image

[2019-3-20 21:11:36] Homebridge is running on port 36537.
[2019-3-20 21:11:39] [SleepNumber] Found Bed Privacy Switch:  bed0
[2019-3-20 21:11:39] [SleepNumber] Found BedSide Occupancy Sensor:  bed0leftSide
[2019-3-20 21:11:39] [SleepNumber] Found BedSide Number Control:  bed0leftSide
[2019-3-20 21:11:39] [SleepNumber] Found BedSide Flex Foundation:  bed0leftSide
(node:7324) UnhandledPromiseRejectionWarning: Error: Cannot add a Service with the same UUID '00000043-0000-1000-8000-0026BB765291' as another Service in this Accessory without also defining a unique 'subtype' property.
    at PlatformAccessory.addService (/usr/lib/node_modules/homebridge/lib/platformAccessory.js:52:15)
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:185:23)
    at Array.forEach (<anonymous>)
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:123:25)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:7324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7324) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:7324) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'updateFoundation' of undefined
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:355:33)
    at Array.forEach (<anonymous>)
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:336:25)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:7324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:7324) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'updateFoundation' of undefined
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:355:33)
    at Array.forEach (<anonymous>)
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:336:25)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:7324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:7324) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'updateFoundation' of undefined
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:355:33)
    at Array.forEach (<anonymous>)
    at SleepNumberPlatform.<anonymous> (/usr/lib/node_modules/homebridge-sleepiq/index.js:336:25)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:7324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
^C[2019-3-20 21:11:57] Got SIGINT, shutting down Homebridge...
(node:7324) UnhandledPromiseRejectionWarning: RequestError: Error: getaddrinfo ENOTFOUND api.sleepiq.sleepnumber.com api.sleepiq.sleepnumber.com:443
    at new RequestError (/usr/lib/node_modules/homebridge-sleepiq/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/usr/lib/node_modules/homebridge-sleepiq/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/usr/lib/node_modules/homebridge-sleepiq/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/usr/lib/node_modules/homebridge-sleepiq/node_modules/request/request.js:185:22)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestError (/usr/lib/node_modules/homebridge-sleepiq/node_modules/request/request.js:881:8)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
(node:7324) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside
DeeeeLAN commented 5 years ago

Try 3.2.8. I did some preliminary testing and I think you should be able to control them with this update. You might need to reset the cache again if it doesn't work after restarting once or twice.

64Spaces commented 5 years ago

Progress! Head and Foot on both Sides are adjustable. Sleep number works, but Occupancy is not triggering. How is the cache reset?

image

+ homebridge-sleepiq@3.2.8
updated 1 package in 6.679s
pi@raspberrypi:~ $ homebridge
[2019-3-20 23:59:50] Loaded config.json with 0 accessories and 1 platforms.
[2019-3-20 23:59:50] ---
[2019-3-20 23:59:51] Loaded plugin: homebridge-sleepiq
[2019-3-20 23:59:51] Registering platform 'homebridge-SleepIQ.SleepNumber'
[2019-3-20 23:59:51] ---
[2019-3-20 23:59:51] Loading 1 platforms...
[2019-3-20 23:59:51] [SleepNumber] Initializing SleepNumber platform...
[2019-3-20 23:59:51] Loading 0 accessories...
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0privacy UUID:  f16f9d3f-0229-453b-87f8-adbd5fbb6987
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0leftSideoccupancy UUID:  c7bb2111-0170-42a2-9ab1-0bf3a9f5e074
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0leftSidenumber UUID:  a4f7b400-00eb-4528-b4fd-5fc1969c3a68
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0leftSideflex UUID:  2e37cbda-83d6-4ab2-8f29-11bf4c27a86b
[2019-3-20 23:59:51] [SleepNumber] Service {
  displayName: 'bed0leftSideFlexHead',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'head',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0leftSideFlexHead',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: [],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] } Service {
  displayName: 'bed0leftSideFlexFoot',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'foot',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0leftSideFlexFoot',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: [],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] }
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0rightSideoccupancy UUID:  f6814b3c-0d35-4e2d-951e-d1662707f89d
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0rightSidenumber UUID:  267ab64c-5e6f-423e-a81a-6b13ad6e1094
[2019-3-20 23:59:51] [SleepNumber] Configuring Cached Accessory:  bed0rightSideflex UUID:  6ecde988-cc76-44a3-899d-53895fff5ce0
[2019-3-20 23:59:51] [SleepNumber] Service {
  displayName: 'bed0rightSideFlexHead',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'head',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0rightSideFlexHead',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: [],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] } Service {
  displayName: 'bed0rightSideFlexFoot',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'foot',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0rightSideFlexFoot',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: [],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] }
Setup Payload:
X-HM://0023IU4LTDHEG
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 318-5 │     
    └────────────┘     

[2019-3-20 23:59:52] Homebridge is running on port 45387.
[2019-3-20 23:59:54] [SleepNumber] bed0 privacy already added from cache
[2019-3-20 23:59:54] [SleepNumber] bed0leftSide occupancy already added from cache
[2019-3-20 23:59:54] [SleepNumber] bed0leftSide number control already added from cache
[2019-3-20 23:59:54] [SleepNumber] bed0leftSide flex foundation already added from cache
[2019-3-20 23:59:54] [SleepNumber] bed0rightSide occupancy already added from cache
[2019-3-20 23:59:54] [SleepNumber] bed0rightSide number control already added from cache
[2019-3-20 23:59:54] [SleepNumber] bed0rightSide flex foundation already added from cache
DeeeeLAN commented 5 years ago

You remove ~/.homebridge/accessories/cachedAccessories

It sets all the accessories up fresh, with the downside of you lose any custom names you give them, and they end up back in the default homebridge room (wherever you put the hub).

That is odd that occupancy isn't working, because that one is pretty hardened. If resetting the cache doesn't work, run in debug and let's see if can figure it out.

Do you have any outlets on your base? Or is that just flex fit 3?

You have a split head but unified foot? What happens with the foot if you adjust one or the other in HomeKit? Do they stay in sync, both moving the same thing?

64Spaces commented 5 years ago

I deleted the accessories folder and the persist folder. No change. I don't think I have any outlets. It's a split head and split feet, they have to be adjusted separately, How do I run in debug?

64Spaces commented 5 years ago

The last run:

pi@raspberrypi:~ $ homebridge
[2019-3-21 00:30:00] Loaded config.json with 0 accessories and 1 platforms.
[2019-3-21 00:30:00] ---
[2019-3-21 00:30:01] Loaded plugin: homebridge-sleepiq
[2019-3-21 00:30:01] Registering platform 'homebridge-SleepIQ.SleepNumber'
[2019-3-21 00:30:01] ---
[2019-3-21 00:30:01] Loading 1 platforms...
[2019-3-21 00:30:01] [SleepNumber] Initializing SleepNumber platform...
[2019-3-21 00:30:01] Loading 0 accessories...
Setup Payload:
X-HM://0023IU4LT207I
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 031-99-185 │     
    └────────────┘     

[2019-3-21 00:30:01] Homebridge is running on port 40135.
[2019-3-21 00:30:03] [SleepNumber] Found Bed Privacy Switch:  bed0
[2019-3-21 00:30:03] [SleepNumber] Found BedSide Occupancy Sensor:  bed0leftSide
[2019-3-21 00:30:03] [SleepNumber] Found BedSide Number Control:  bed0leftSide
[2019-3-21 00:30:03] [SleepNumber] Found BedSide Flex Foundation:  bed0leftSide
[2019-3-21 00:30:03] [SleepNumber] Service {
  displayName: 'bed0leftSideFlexHead',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'head',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0leftSideFlexHead',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: 
   [ Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Hue',
       UUID: '00000013-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Saturation',
       UUID: '0000002F-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: '',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Color Temperature',
       UUID: '000000CE-0000-1000-8000-0026BB765291',
       iid: null,
       value: 140,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 } ],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] } Service {
  displayName: 'bed0leftSideFlexFoot',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'foot',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0leftSideFlexFoot',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: 
   [ Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Hue',
       UUID: '00000013-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Saturation',
       UUID: '0000002F-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: '',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Color Temperature',
       UUID: '000000CE-0000-1000-8000-0026BB765291',
       iid: null,
       value: 140,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 } ],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] }
[2019-3-21 00:30:03] [SleepNumber] Found BedSide Occupancy Sensor:  bed0rightSide
[2019-3-21 00:30:03] [SleepNumber] Found BedSide Number Control:  bed0rightSide
[2019-3-21 00:30:03] [SleepNumber] Found BedSide Flex Foundation:  bed0rightSide
[2019-3-21 00:30:03] [SleepNumber] Service {
  displayName: 'bed0rightSideFlexHead',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'head',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0rightSideFlexHead',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: 
   [ Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Hue',
       UUID: '00000013-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Saturation',
       UUID: '0000002F-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: '',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Color Temperature',
       UUID: '000000CE-0000-1000-8000-0026BB765291',
       iid: null,
       value: 140,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 } ],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] } Service {
  displayName: 'bed0rightSideFlexFoot',
  UUID: '00000043-0000-1000-8000-0026BB765291',
  subtype: 'foot',
  iid: null,
  characteristics: 
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: 'bed0rightSideFlexFoot',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'On',
       UUID: '00000025-0000-1000-8000-0026BB765291',
       iid: null,
       value: false,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 },
     Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0,
       _events: [Object],
       _eventsCount: 1 } ],
  optionalCharacteristics: 
   [ Characteristic {
       displayName: 'Brightness',
       UUID: '00000008-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Hue',
       UUID: '00000013-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Saturation',
       UUID: '0000002F-0000-1000-8000-0026BB765291',
       iid: null,
       value: 0,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: null,
       value: '',
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 },
     Characteristic {
       displayName: 'Color Temperature',
       UUID: '000000CE-0000-1000-8000-0026BB765291',
       iid: null,
       value: 140,
       status: null,
       eventOnlyCharacteristic: false,
       props: [Object],
       subscriptions: 0 } ],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [] }
DeeeeLAN commented 5 years ago

If you have other homebridge accessories, you should copy ~/.homebridge to something like ~/.homebridge-debug and change the port in the config of the copy, then at the command line run

DEBUG=* homebridge -D -U ~/.homebridge-debug

if you don't have other accessories, just use ~/.homebridge

This will dump out a lot more messages.

But first update to 3.2.9

64Spaces commented 5 years ago

SleepIQ is the only thing on the test hub, so I can run it in debug. Does the debug data go to a log or is it displayed in terminal continuously?

I deactivated the test hub and went back to the 2.0.4 hub and Occupancy would not trigger until after a full reboot. Maybe I should try a reboot on the test hub tomorrow. I’ll test it all again tomorrow.

On Mar 21, 2019, at 12:41 AM, DeeeeLAN notifications@github.com wrote:

If you have other homebridge accessories, you should copy ~/.homebridge to something like ~/.homebridge-debug and change the port in the config of the copy, then at the command line run

DEBUG=* homebridge -D -U ~/.homebridge-debug

if you don't have other accessories, just use ~/.homebridge

This will dump out a lot more messages.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

64Spaces commented 5 years ago

I think we are close. The bed positions are working. Thanks again

DeeeeLAN commented 5 years ago

It gets displayed in the terminal. If you want to dump it to a log, just append '> ~/homebridge-debug.log'

Yes, try rebooting, maybe there is something weird going on. I will wait for your data.

64Spaces commented 5 years ago

Success with 3.2.9 running! All buttons and sensors are working. I will let it run today and follow up tonight.

64Spaces commented 5 years ago

Is this an issue?

[2019-3-21 12:58:33] [SleepNumber] SleepIQ JSON data successfully retrieved
(node:29175) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined
    at SleepNumberPlatform.parseData (/usr/lib/node_modules/homebridge-sleepiq/index.js:311:15)
    at SleepNumberPlatform.fetchData (/usr/lib/node_modules/homebridge-sleepiq/index.js:304:18)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:29175) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:29175) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
DeeeeLAN commented 5 years ago

Probably related to the foundation, I didn't test that part (since I don't have any data to fetch), so that is not surprising. I will take a look later. Was it accompanied with anything notable, like the foundation stopped working? Where was it in the log? Right at the beginning or at the end? Was it repeated multiple times, or just once?

64Spaces commented 5 years ago

It pops up about five minutes after starting homebridge. It doesn't crash homebridge. It's updating properly every 5 seconds or so and then pops up. But I was looking at it remotely,

Although is seems that even though the bed position changes worked this morning in the Apple Home App, the position might not be syncing properly when the remote is used and maybe the sleep number is not syncing. I will experiment more tonight. Thanks again.

64Spaces commented 5 years ago

Emailed you a log. I think I may have to figure out how to reset and reinstall the sleep number software. My beds get stuck in occupancy (in the SleepIQ App). The head and foot positions work, so thank you. Let me know what you think of the log.

64Spaces commented 5 years ago

Except for some general syncing issues, the Bed Position feature is active and working in scenes on my Homebridge. Thanks so much for this feature. I'm going to close this for now.

DeeeeLAN commented 5 years ago

Looking over your log, it looks like there is an issue with fetching the data for the foundation. The foundation returns good data, but by the time it makes it to the parsing a few lines later, it is printing undefined. That would explain why any changes you make to the foundation separate from homekit don't sync over as expected. Go ahead and open a new ticket for this and any other syncing issues you find so I can get them cleaned up.

64Spaces commented 5 years ago

Will do. I will test some syncing and open a new ticket. Thanks again.