-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property Response Improvements #138
Conversation
* improved property map object with prototype functions along with item type per capability enforcement * updated alexa response property state accuracy logic with ability to associate an item sensor through metadata parameter * added ability to define lock property state mapping when using an item sensor through metadata parameter * updated temperature mode binding mapping to differentiate legacy bindings from latest one * refactored rest functions code to accomodate for future alexa gateway calls * changed the lambda function return method to use handler callback instead of context * updated report state function to use generic alexa response property state logic
Thanks, this is indeed a huge PR, its going to take me some time to review, but at a quick glance this all seems reasonable refactoring and clean up of the project. Due to how much there is changed, I will want to get this merged first before we add anything else otherwise I see merge conflicts in our future. |
I very much appreciate that 😄 Let me know if you have any questions. I am with you on getting this merged as soon as possible. |
I'm good with the other changes, if something breaks we can deal with it, but i like the refactoring you did, we should get this merged and move on! Thanks, awesome work! |
Give me a few minutes. I am pushing the changes for the bug you identified and you can merge the changes. I also going to add a test case for it. Thanks. |
Ok we are set. I added the test case and also simplified the last thermostat discovery test case to focus on what we wanted to test since the rest is taken care of by the other cases. |
Awesome, thanks! |
* Alexa Skills API v3, major rewrite Signed-off-by: Dan Cunningham <[email protected]> * Formatting changes Signed-off-by: digitaldan <[email protected]> * Formatting, starting to add support for tag params, change catagories Signed-off-by: digitaldan <[email protected]> * Major refactoring of cookies, store propertyMap as json in Alexa cookies. Adds support for tag paramters. Signed-off-by: Dan Cunningham <[email protected]> * Fixing mappings Signed-off-by: Dan Cunningham <[email protected]> * Updated README, added endpoint and item catgeories from tags Signed-off-by: Dan Cunningham <[email protected]> * more updates Signed-off-by: Dan Cunningham <[email protected]> * Renaming alexaControllerProperties.js to alexaContextProperties.js Signed-off-by: digitaldan <[email protected]> * Adds temp scale to v2 items, cleans up source Signed-off-by: Dan Cunningham <[email protected]> * Send numeric values Signed-off-by: Dan Cunningham <[email protected]> * Fixes for color setting and reporting Signed-off-by: digitaldan <[email protected]> * fixing locks Signed-off-by: digitaldan <[email protected]> * Fix for v3 thermostat handling. * properties[propertyName.itemName] is undefined * The cases 'CurrentTemperature' and 'TargetTemperature' seem to be mixed up Signed-off-by: Frank Meies [email protected] * Added mocha tests * Fix group of lights * Fix setting brightness at color light * Alexa Response State Accuracy Improvement * improved Alexa response state accuracy by getting latest openhab state after posting command * added color hsb state support for brightness, percentage and power state properties * allowed color hsb state decimal value to be sent to openhab * added jammed lock state property support * fixed v2 tag no matching group type capability null exception * cleaned up few typos & unecessary functions * Mocha Testing Improvement * added assert custom function module to simplify unit test creation * organized discovery & directives test case settings in seperate files to improve readability * added test cases for most of implemented functionalities * set log level to error limiting unecessary console output * Scene Trigger Support * added supportsDeactivation parameter support (enabled by default) * fixed scene trigger response based on api reference * Color Temperature Support * added color temperature control support * implemented support for dimmer items to work with hue + lifx (default) and number items for custom integration using the color temperature value * Thermostat Mode Binding Tag Parameter Support * added ability to define through tag parameter the binding used in OH (ecobee, nest & zwave bindings currently only defined) * added default mapping if no binding or custom mapping specified * recycled deprecated normalize thermostat mode function to handle mapping logic * fixed thermostat mode context state property format based on api reference * fixed adjust target temperature function state calculation * Entertainment Controller Support * added/improved channel, input, speaker control support * added ability to define default speaker volume increment through tag parameter * fixed step speaker context state property format based on api reference * Mocha Testing Reorganization * added v2 testing capabilities * split test case files into v2/v3 folders * cleaned up test case files format * added travis configuration * added default rest config settings fallback logic in case config.js not found * Connector V2 Support Fix * updated v2 support after being broken by recent changes * added v2 test cases for all implemented functionalities * Readme Updates + Color Temperature Improvement (#64) * Color Temperature Dimmer Item Increment Tag Parameter Support * added increment tag parameter support for color temperature dimmer item * refactored code for generateControlError function * Readme Updates * added/updated supported item mapping tag based on recent changes * cleaned up spelling errors * Metadata Support * added metadata openhab functionality support * added/expanded v2 tag ability with parameters and included in item metadata * limited group endpoint to alexa supported categories only * improved display categories determination logic * Upgrade to latest lambda deploy package Signed-off-by: digitaldan <[email protected]> * Metadata Support Updates (#69) * changed core logic based on item metadata object * moved v3 parameters support through tags to metadata only * updated concept of metadata labels aligned with v2 tags * Temperature Sensor Outside Group v2 Category Fix (#71) * Support user defined Thermostat modes with numeric valuse Signed-off-by: digitaldan <[email protected]> * Fixes #83 (#114) Signed-off-by: digitaldan <[email protected]> * V3 travis errors fix (#115) * Thanks tests! Fixes bad checks for undefied values Signed-off-by: digitaldan <[email protected]> * added test to check for numeric value in user map for thermos Signed-off-by: digitaldan <[email protected]> * Stereo mute fix (#117) * Thanks tests! Fixes bad checks for undefied values Signed-off-by: digitaldan <[email protected]> * added test to check for numeric value in user map for thermos Signed-off-by: digitaldan <[email protected]> * fixes stereo mute issue Signed-off-by: digitaldan <[email protected]> * Revert "Stereo mute fix (#117)" (#118) This reverts commit ea4ca19. * Update README.md * Fixes issue reporting thermostat modes (#121) Signed-off-by: digitaldan <[email protected]> * fixes failing tests (#122) Signed-off-by: digitaldan <[email protected]> * This adds "comfort ranges" to thermostats used in dual mode. Fixes #119 (#120) * This adds "comfort ranges" to thermostats used in dual mode. Fixes #119 Signed-off-by: digitaldan <[email protected]> * Fixed looping logic Signed-off-by: digitaldan <[email protected]> * updated readme and renamed tests Signed-off-by: digitaldan <[email protected]> * Fix StepSpeaker discovery (#99) * Fix StepSpeaker discovery * Fix StepSpeaker discovery - test fixed * Fix StepSpeaker discovery - test fixed * Closes #128 (#129) Signed-off-by: Dan Cunningham <[email protected]> * Update README.md Closes #124 * Adds editable to rest request to get around oh issue here https://community.openhab.org/t/field-editable-is-required-when-getting-items-on-the-rest-api/65094/5 . (#131) Fixes #126 Signed-off-by: Dan Cunningham <[email protected]> * Adds the original value to be returned when failing map to a alexa mode. For thermostat modes, this will at least allow ALexa to report arbratray values. (#132) Signed-off-by: Dan Cunningham <[email protected]> * V3 thermostat supported modes (#133) * Adds optional supported modes to thermostat Signed-off-by: digitaldan <[email protected]> * only add config option if we have supportedModes Signed-off-by: digitaldan <[email protected]> * Update Readme with supportedModes Signed-off-by: digitaldan <[email protected]> * V3 winston logging (#134) * Switch to using winston as a logger Signed-off-by: digitaldan <[email protected]> * better checking of env vars Signed-off-by: digitaldan <[email protected]> * Fixed typo, use error loggin when running tests Signed-off-by: digitaldan <[email protected]> * Updating documentation (#136) * Updating documentation Signed-off-by: digitaldan <[email protected]> * Small typo Signed-off-by: digitaldan <[email protected]> * Small change to wording Signed-off-by: digitaldan <[email protected]> * Still more changes Signed-off-by: digitaldan <[email protected]> * Group item with no tag discovery fix (#83) (#135) * Update README.md * Update USAGE.md * Update USAGE.md * Update USAGE.md * Update USAGE.md * Fixes an error with how modes can be mapped (#137) Signed-off-by: digitaldan <[email protected]> * Property Response Improvements (#138) * Property Response Improvements * improved property map object with prototype functions along with item type per capability enforcement * updated alexa response property state accuracy logic with ability to associate an item sensor through metadata parameter * added ability to define lock property state mapping when using an item sensor through metadata parameter * updated temperature mode binding mapping to differentiate legacy bindings from latest one * refactored rest functions code to accomodate for future alexa gateway calls * changed the lambda function return method to use handler callback instead of context * updated report state function to use generic alexa response property state logic * Thermostat mode property not defined capabilities prototype bug fix * Item State Presentation Format Support (#141) * Remove v2 logic from code (#144) * Move to using request library and native promises for all rest calls (#145) * Move to using request library and native promises for all rest calls Signed-off-by: digitaldan <[email protected]> * Fixed typo Signed-off-by: digitaldan <[email protected]> * Fixing merge conflicts Signed-off-by: digitaldan <[email protected]> * Update config file Signed-off-by: digitaldan <[email protected]> * Move to nodejs 8.10 Signed-off-by: digitaldan <[email protected]> * Fix temperature conversion for thermostats (#146) * Item Scale Unit of Measurement Support (#148) * Item Scale Unit of Measurement Support * Updated item state normalization to only occur when pattern defined * Fix tag values not displayed in USAGE.md * Contact and Motion Sensors Support (#149) * added generic property state normalization function returning relevant alexa state * updated item state normalization to only occur when pattern and state defined * updated display categories list * Alexa Response Customization Framework Improvements (#150) * Alexa Response Customization Framework Improvements * corrected namespace on interface specific error reponse messages * decamilized endpoint group name to match display categories format * code cleanup * Channel Control Request By Name Improvement (#151) * Additional code refactoring (#152) * Limit item state normalization to only process numerical format placeholders (#154) * V3 logging fixes (#156) * Fixed logging to support object printing Signed-off-by: digitaldan <[email protected]> * added back in setting log level in test Signed-off-by: digitaldan <[email protected]> * Usage updates to point our other Alexa integration, better description of the skill (#158) Signed-off-by: digitaldan <[email protected]> * Major code refactoring (#160) * improved alexa capability settings and property state normalization management * improved alexa response data validation * moved alexa directives support into seperate classes * added alexa property schema concept to manage property states * updated input controller to latest api changes * renamed thermostat setpoint comfort range parameter to use camelcase format * removed playback support for stop operation in line with player item type command support * added ability to use openhab regional settings to determine temperature scale * added log error test capture preventing unecessary output during successful test units * added alexa official json schema validation to test suite * restructed project folders * Mode Range Toggle Controller Support (#162) * Mode Range Toggle Controller Support * added multi-instance support to accomodate for the new capabilities * improved test suite to check for new standard capabilities parameters * revamped unit of measurement support * removed power level unecessary normalize function * added kelvin temperature conversation normalization * Removed asset id prefix requirement allowing usage in supported modes configuration * Combined range supported presets parameters configuration into one * Updated supported modes and presets configuration resources format * Security Panel Controller Support (#166) * Security Panel Controller Support * Added ability to restrict the properties included in response context * Added ability to trigger an error reponse based on properties response name and value * Moved supported property states into schema config object * Fixed object not properly cloned causing some reference objects to be unecessarily updated * Improved error handling including troubleshooting documentation * add table of contents (#167) Signed-off-by: digitaldan <[email protected]> * Equalizer Controller Support (#168) * added ability to configure sub-property components to accommodate new capability * added ability to report a property under a different name than the one defined in discovery * added logic to determine thermostat binding 2.x parameter based on item channel metadata * added logic to determine mode range toggle friendly names based on item synonyms metadata * fixed log array object representation issue due to winston limitation * fixed discovery test directive request incorrectly including header correlation token * added schema validation to discovery test cases * updated validation json schema * moved mocha options into standard config file Signed-off-by: jsetton <[email protected]> * Remove tag examples for metadata labels, add metadata examples in beg… (#169) * Remove tag examples for metadata labels, add metadata examples in begining of page Signed-off-by: digitaldan <[email protected]> * Expanded v2 support documentation Signed-off-by: digitaldan <[email protected]> * fixed link typo Signed-off-by: digitaldan <[email protected]> * Typo Signed-off-by: digitaldan <[email protected]> * moved other integrations to bottom of page Signed-off-by: digitaldan <[email protected]> * added additional explaination to v2 tags Signed-off-by: digitaldan <[email protected]> * Update documentation (#172) Signed-off-by: digitaldan <[email protected]> * Alexa Skills Kit CLI Deployment Support (#175) * Alexa Skills Kit CLI Deployment Support Signed-off-by: jsetton <[email protected]> * Added ESLint configuration + lint cleanup Signed-off-by: jsetton <[email protected]> * Remove SecurityPanelController arm instant support (#180) * Remove SecurityPanelController arm instant support Signed-off-by: jsetton <[email protected]> * Update Alexa validation schema Signed-off-by: jsetton <[email protected]> * StepSpeaker Controller Volume Steps Command Value Fix (#182) * Seperated volume property schema to differentiate the two speaker capabilities * Added support for default volume steps increment metadata parameter * Improved context response for non-reportable properties * Improved invalid directive error handling when relevant property map settings not defined * Minor code and documentation cleanup Signed-off-by: jsetton <[email protected]> * revert file Signed-off-by: digitaldan <[email protected]> * Update Readme to use master for travis status Signed-off-by: digitaldan <[email protected]> * Update install directions to use master branch Signed-off-by: digitaldan <[email protected]>
These are the improvements that I had originally included in #74. I removed all the code related to the asynchronous deferred response support. I know it's a big change but it includes a bunch of property response improvements along with some code refactoring that would allow us to easily maintain the code going forward. It also includes logic to enforce item type per capability.
I have been running this code as my OH skill for the last 8 months without any issue. I also made sure to include and also improve, in some cases, all the changes you have committed the last few days. So it should be easy to merge.
Feel free to comment on my changes if you have any questions.