joeyhage / homebridge-alexa-smarthome

Connect Alexa devices to HomeKit
MIT License
62 stars 20 forks source link

inspired by quick and dirty fan support - quick and dirty AIR_FRESHENER support #65

Closed cowboyrushforth closed 6 months ago

cowboyrushforth commented 8 months ago

Hi,

This is just 1 line of change, but was able to get my Pura diffusers that are connected via Alexa to be turned off and on using this commit.

Here is some debug logs:

Oct 25 16:46:04 raspberrypi homebridge[10716]: [10/25/2023, 4:46:04 PM] [HomebridgeAlexaSmartHome] BEGIN devices connected to Alexa account Oct 25 16:46:04 raspberrypi homebridge[10716]: [ Oct 25 16:46:04 raspberrypi homebridge[10716]: { Oct 25 16:46:04 raspberrypi homebridge[10716]: "displayName": "Dining Room Pura Diffuser", Oct 25 16:46:04 raspberrypi homebridge[10716]: "deviceType": "AIR_FRESHENER" Oct 25 16:46:04 raspberrypi homebridge[10716]: }, Oct 25 16:46:04 raspberrypi homebridge[10716]: { Oct 25 16:46:04 raspberrypi homebridge[10716]: "displayName": "Bedroom Pura Diffuser", Oct 25 16:46:04 raspberrypi homebridge[10716]: "deviceType": "AIR_FRESHENER" Oct 25 16:46:04 raspberrypi homebridge[10716]: }, Oct 25 16:46:04 raspberrypi homebridge[10716]: { Oct 25 16:46:04 raspberrypi homebridge[10716]: "displayName": "Living Room Pura Diffuser", Oct 25 16:46:04 raspberrypi homebridge[10716]: "deviceType": "AIR_FRESHENER" Oct 25 16:46:04 raspberrypi homebridge[10716]: }, Oct 25 16:46:04 raspberrypi homebridge[10716]: { Oct 25 16:46:04 raspberrypi homebridge[10716]: "displayName": "Kitchen Pura Diffuser", Oct 25 16:46:04 raspberrypi homebridge[10716]: "deviceType": "AIR_FRESHENER" Oct 25 16:46:04 raspberrypi homebridge[10716]: } Oct 25 16:46:04 raspberrypi homebridge[10716]: ]

Oct 25 16:46:05 raspberrypi homebridge[10716]: [10/25/2023, 4:46:05 PM] [HomebridgeAlexaSmartHome] Bedroom Pura Diffuser ::: Attempting to add accessory(s) for device: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "id": "5b643bdc-5f1b-4147-9807-7cbb0d0417e2", Oct 25 16:46:05 raspberrypi homebridge[10716]: "displayName": "Bedroom Pura Diffuser", Oct 25 16:46:05 raspberrypi homebridge[10716]: "description": "A Pura smart home diffuser", Oct 25 16:46:05 raspberrypi homebridge[10716]: "supportedProperties": [ Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOff", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setColor", Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOn", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setModeValue@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.SelectedBay", Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOff@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.DiffuserLight", Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOn@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.DiffuserLight", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setRangeValue@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.Brightness", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setRangeValue@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.Intensity" Oct 25 16:46:05 raspberrypi homebridge[10716]: ], Oct 25 16:46:05 raspberrypi homebridge[10716]: "supportedTriggers": [], Oct 25 16:46:05 raspberrypi homebridge[10716]: "supportedOperations": [ Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOff", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setColor", Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOn", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setModeValue@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.SelectedBay", Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOff@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.DiffuserLight", Oct 25 16:46:05 raspberrypi homebridge[10716]: "turnOn@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.DiffuserLight", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setRangeValue@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.Brightness", Oct 25 16:46:05 raspberrypi homebridge[10716]: "setRangeValue@5b643bdc-5f1b-4147-9807-7cbb0d0417e2_Diffuser.Intensity" Oct 25 16:46:05 raspberrypi homebridge[10716]: ], Oct 25 16:46:05 raspberrypi homebridge[10716]: "availability": "AVAILABLE", Oct 25 16:46:05 raspberrypi homebridge[10716]: "icon": { Oct 25 16:46:05 raspberrypi homebridge[10716]: "@iconType": "SmartHomeApplianceType", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": "AIR_FRESHENER" Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: "providerData": { Oct 25 16:46:05 raspberrypi homebridge[10716]: "enabled": true, Oct 25 16:46:05 raspberrypi homebridge[10716]: "relationships": [], Oct 25 16:46:05 raspberrypi homebridge[10716]: "categoryType": "APPLIANCE", Oct 25 16:46:05 raspberrypi homebridge[10716]: "deviceType": "AIR_FRESHENER", Oct 25 16:46:05 raspberrypi homebridge[10716]: "dmsDeviceIdentifiers": [] Oct 25 16:46:05 raspberrypi homebridge[10716]: } Oct 25 16:46:05 raspberrypi homebridge[10716]: }

Oct 25 16:46:05 raspberrypi homebridge[10716]: [10/25/2023, 4:46:05 PM] [HomebridgeAlexaSmartHome] Bedroom Pura Diffuser ::: Current state: [ Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.RangeController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "rangeValue", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": 8, Oct 25 16:46:05 raspberrypi homebridge[10716]: "instance": "Diffuser.Intensity" Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.ToggleController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "toggleState", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": "OFF", Oct 25 16:46:05 raspberrypi homebridge[10716]: "instance": "Diffuser.DiffuserLight" Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.ColorPropertiesController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "colorProperties", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": { Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "dark_orange", Oct 25 16:46:05 raspberrypi homebridge[10716]: "localizationMap": { Oct 25 16:46:05 raspberrypi homebridge[10716]: "en": "Dark Orange", Oct 25 16:46:05 raspberrypi homebridge[10716]: "en-US": "Dark Orange", Oct 25 16:46:05 raspberrypi homebridge[10716]: "en-UK": "Dark Orange", Oct 25 16:46:05 raspberrypi homebridge[10716]: "de": "Dunkles Orange", Oct 25 16:46:05 raspberrypi homebridge[10716]: "jp": null, Oct 25 16:46:05 raspberrypi homebridge[10716]: "fr": null, Oct 25 16:46:05 raspberrypi homebridge[10716]: "it": "Arancione scuro", Oct 25 16:46:05 raspberrypi homebridge[10716]: "es-ES": "Calabaza", Oct 25 16:46:05 raspberrypi homebridge[10716]: "es-MX": "Calabaza", Oct 25 16:46:05 raspberrypi homebridge[10716]: "pt-BR": null, Oct 25 16:46:05 raspberrypi homebridge[10716]: "es-US": "Calabaza", Oct 25 16:46:05 raspberrypi homebridge[10716]: "hi-IN": null Oct 25 16:46:05 raspberrypi homebridge[10716]: } Oct 25 16:46:05 raspberrypi homebridge[10716]: } Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.EndpointHealth", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "connectivity", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": { Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": "OK" Oct 25 16:46:05 raspberrypi homebridge[10716]: } Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.ColorController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "color", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": { Oct 25 16:46:05 raspberrypi homebridge[10716]: "hue": 30, Oct 25 16:46:05 raspberrypi homebridge[10716]: "saturation": 1, Oct 25 16:46:05 raspberrypi homebridge[10716]: "brightness": 1 Oct 25 16:46:05 raspberrypi homebridge[10716]: } Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.ModeController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "mode", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": "DiffuserMode.Default", Oct 25 16:46:05 raspberrypi homebridge[10716]: "instance": "Diffuser.Controller" Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.PowerController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "powerState", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": "OFF" Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.RangeController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "rangeValue", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": 2, Oct 25 16:46:05 raspberrypi homebridge[10716]: "instance": "Diffuser.Brightness" Oct 25 16:46:05 raspberrypi homebridge[10716]: }, Oct 25 16:46:05 raspberrypi homebridge[10716]: { Oct 25 16:46:05 raspberrypi homebridge[10716]: "namespace": "Alexa.ModeController", Oct 25 16:46:05 raspberrypi homebridge[10716]: "name": "mode", Oct 25 16:46:05 raspberrypi homebridge[10716]: "value": "", Oct 25 16:46:05 raspberrypi homebridge[10716]: "instance": "Diffuser.SelectedBay" Oct 25 16:46:05 raspberrypi homebridge[10716]: } Oct 25 16:46:05 raspberrypi homebridge[10716]: ]

Happy to spend some additional time on this, but curious your thoughts and how one might go about it. Is a Switch the best approach, or would be there be some way of representing at least the on/off and the Diffuser.Intensity, Diffuser.Brightness, Diffuser.DiffuserLight?

joeyhage commented 6 months ago

@cowboyrushforth thanks so much for creating this PR and sharing your findings. Apologies for the delay getting it added. I will be adding air freshener support shortly in v2.0.8.