bassrock / homebridge-flair

Homebridge Plugin for Flair Smart Vents
18 stars 6 forks source link

Puck status incorrect #1

Closed HammerAce42 closed 4 years ago

HammerAce42 commented 4 years ago

Firstly, thanks for building this plugin. So exciting to not have to pass through SmartThings to get vent controls into HomeKit!

Vent controls and status are working fine, but all pucks show as off status even though the structure is set to cool (manually set - I use a Nest Thermostat and have migrated over to a Google Account so the integration no longer works).

I am seeing the following error in the log:

[5/10/2020, 3:52:05 PM] [Flair] TypeError: Cannot read property 'id' of undefined
    at Client.getStructure (/homebridge/node_modules/homebridge-flair/node_modules/flair-api-ts/src/client/client.ts:216:75)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at FlairPlatform.getNewStructureReadings (/homebridge/node_modules/homebridge-flair/src/platform.ts:88:27)
    at Timeout._onTimeout (/homebridge/node_modules/homebridge-flair/src/platform.ts:56:11)
bassrock commented 4 years ago

Interesting that means the api is not returning a structure id for you. Are you able to provide what the api response looks like for /api/structures? (filtering out anything sensitive).

As for them showing as off. That's the intended design, unless Flair is set to Auto control the Pucks show as off since setting their temperature will do nothing otherwise.

HammerAce42 commented 4 years ago

Flair is set to auto control in this case though - the vents are controlled by the set point on the pucks.

How do I view the api response?

Thanks!

bassrock commented 4 years ago

You can use the api docs here with Postman https://documenter.getpostman.com/view/5353571/Rzfnj6YR?version=latest#386aa723-aa8d-4a8c-8f0d-9a55ad0faae8

If you are unable to do that, I can make the next version log the api response with debugging enabled.

HammerAce42 commented 4 years ago

Here is the API response.

{"meta": {"self": "/api/structures", "first": "/api/structures?page%5Bsize%5D=50&page%5Bpage%5D=1", "last": "/api/structures?page%5Bsize%5D=50&page%5Bpage%5D=1", "next": null, "prev": null}, "data": [{"type": "structures", "relationships": {"vents": {"links": {"self": "/api/structures/9140/relationships/vents", "related": "/api/structures/9140/vents"}}, "current-state": {"links": {"related": "/api/structures/9140/current-state"}, "data": {"type": "structure-states", "id": "8dd58549-1027-4aa3-85d0-79879b543415"}}, "geofence-events": {"links": {"self": "/api/structures/9140/relationships/geofence-events", "related": "/api/structures/9140/geofence-events"}}, "active-schedule": {"links": {"self": "/api/structures/9140/relationships/active-schedule", "related": "/api/structures/9140/active-schedule"}, "data": null}, "editor-users": {"links": {"self": "/api/structures/9140/relationships/editor-users", "related": "/api/structures/9140/editor-users"}}, "default-zone": {"links": {"self": "/api/structures/9140/relationships/default-zone", "related": "/api/structures/9140/default-zone"}}, "beacon-sightings": {"links": {"self": "/api/structures/9140/relationships/beacon-sightings", "related": "/api/structures/9140/beacon-sightings"}}, "occupancy-conclusions": {"links": {"related": "/api/structures/9140/occupancy-conclusions"}}, "supported-device-brands": {"links": {"related": "/api/structures/9140/supported-device-brands"}}, "viewer-users": {"links": {"self": "/api/structures/9140/relationships/viewer-users", "related": "/api/structures/9140/viewer-users"}}, "remote-sensors": {"links": {"self": "/api/structures/9140/relationships/remote-sensors", "related": "/api/structures/9140/remote-sensors"}}, "pucks": {"links": {"self": "/api/structures/9140/relationships/pucks", "related": "/api/structures/9140/pucks"}}, "releases": {"links": {"self": "/api/structures/9140/relationships/releases", "related": "/api/structures/9140/releases"}}, "invitations": {"links": {"self": "/api/structures/9140/relationships/invitations", "related": "/api/structures/9140/invitations"}}, "zones": {"links": {"self": "/api/structures/9140/relationships/zones", "related": "/api/structures/9140/zones"}}, "thermostats": {"links": {"self": "/api/structures/9140/relationships/thermostats", "related": "/api/structures/9140/thermostats"}}, "alerts": {"links": {"related": "/api/structures/9140/alerts"}}, "schedules": {"links": {"self": "/api/structures/9140/relationships/schedules", "related": "/api/structures/9140/schedules"}}, "structure-states": {"links": {"related": "/api/structures/9140/structure-states"}}, "weather-readings": {"links": {"related": "/api/structures/9140/weather-readings"}}, "geofences": {"links": {"self": "/api/structures/9140/relationships/geofences", "related": "/api/structures/9140/geofences"}}, "current-weather": {"links": {"related": "/api/structures/9140/current-weather"}}, "hvac-units": {"links": {"self": "/api/structures/9140/relationships/hvac-units", "related": "/api/structures/9140/hvac-units"}}, "admin-users": {"links": {"self": "/api/structures/9140/relationships/admin-users", "related": "/api/structures/9140/admin-users"}}, "current-conclusions": {"links": {"related": "/api/structures/9140/current-conclusions"}}, "rooms": {"links": {"self": "/api/structures/9140/relationships/rooms", "related": "/api/structures/9140/rooms"}}, "integration-structures": {"links": {"self": "/api/structures/9140/relationships/integration-structures", "related": "/api/structures/9140/integration-structures"}}}, "attributes": {"longitude": REDACTED, "state": "WA", "release-channel": "production", "humidity-away-min": 10, "setup-step": "structure/config", "updated-at": "2020-05-10T23:40:28.365542+00:00", "setup-mode-first-time": true, "name": "Rise", "active-schedule-id": null, "hysteresis-heat-cool-mode": 111, "puck-client-id": “REDACTED”, "temp-away-max-c": 32.22, "frozen-pipe-pet-protect": true, "hold-until": null, "setup-complete": true, "home": true, "licensed-features": [], "location-type": "address", "state-updated-at": "2020-05-10T23:40:28.361572+00:00", "time-zone": "America/Los_Angeles", "hysteresis-b": 100, "structure-away-mode": "Smart Away", "country": "US", "hold-until-schedule-event": false, "reporting-gateway": true, "set-point-mode": "Home Evenness For Active Rooms Flair Setpoint", "city": "REDACTED”, "structure-type": null, "structure-heat-cool-mode": "cool", "location": “REDACTED”, "zip-code": “REDACTED”, "preheat-precool": true, "home-away-mode": "Manual", "hold-reason": null, "set-point-temperature-c": 21.11, "humidity-away-max": 80, "puck-client-secret": “REDACTED”, "temp-away-min-c": 21.0, "default-hold-duration": "Forever", "structure-heat-cool-mode-calculated": "cool", "temperature-scale": "F", "hysteresis-a": 50, "is-active": false, "mode": "auto", "created-at": "2019-06-29T01:39:29.360190+00:00", "use-remote-sensor-occupancy": null, "setup-mode": false, "latitude": REDACTED, "structure-heat-cool-mode-popup-resolved-at": "2020-05-10T16:45:44+00:00"}, "id": "9140"}]}

bassrock commented 4 years ago

Oh interesting you have is-active set to false.. I use that combined with Home to determine the primary home. https://github.com/bassrock/node-flair-api-ts/blob/a20077b15697b7e4cfff30572474559d4aa85e35/src/client/models/structure.ts#L40

Do you only have 1 home or multiple? Any thing show in the app that indicate why it would not be active?

HammerAce42 commented 4 years ago

I only have one active home. Nothing in the app that would indicate it’s not active. See screenshots below.

4039C8AA-BE6A-47DC-B8DC-4B8A95BD45BE A0D6F9C2-C34C-4AD4-9042-1931B24246AC

bassrock commented 4 years ago

Can you try 1.0.2 that I just released to see if that fixes this? I changed how I detect a primary structure.

HammerAce42 commented 4 years ago

That fixed it - thanks!