Thank you 👍
* added zwave lock state from alarm type workaround
* fixed test indents
* more linting fixes
* one more linting fix
* simplified logic
* fixed lint new lines
* fixed merge conflict issue
* fixed definition of _alarm_type_workaround in zwave lock
* Set lock status correctly for Schlage BE469 Z-Wave locks
PR #17386 attempted to improve the state of z-wave lock tracking for
some problematic models. However, it operated under a flawed
assumptions. Namely, that we can always trust `self.values` to have
fresh data, and that the Schlage BE469 sends alarm reports after every
lock event. We can't trust `self.values`, and the Schlage is very
broken. :)
When we receive a notification from the driver about a state change,
we call `update_properties` - but we can (and do!) have _stale_
properties left over from previous updates. #17386 really works best
if you start from a clean slate each time. However, `update_properties`
is called on every value update, and we don't get a reason why.
Moreover, values that weren't just refreshed are not removed. So blindly
looking at something like `self.values.access_control` when deciding to
apply a workaround is not going to always be correct - it may or may not
be, depending on what happened in the past.
For the sad case of the BE469, here are the Z-Wave events that happen
under various circumstances:
RF Lock / Unlock:
- Send: door lock command set
- Receive: door lock report
- Send: door lock command get
- Receive: door lock report
Manual lock / Unlock:
- Receive: alarm
- Send: door lock command get
- Receive: door lock report
Keypad lock / Unlock:
- Receive: alarm
- Send: door lock command get
- Receive: door lock report
Thus, this PR introduces yet another work around - we track the current
and last z-wave command that the driver saw, and make assumptions based
on the sequence of events. This seems to be the most reliable way to go
- simply asking the driver to refresh various states doesn't clear out
alarms the way you would expect; this model doesn't support the access
control logging commands; and trying to manually clear out alarm state
when calling RF lock/unlock was tricky.
The lock state, when the z-wave network restarts, may look out of sync
for a few minutes. However, after the full network restart is complete,
everything looks good in my testing.
* Fix linter
* Allow verisure locks to be configured with a default code
* linting fix
* PR feedback
* PR feedback - try harder to prevent future typos
A python mock is a magical thing, and will respond to basicaly
any method you call on it. It's somewhat better to assert against
an explicit variable named 'mock', rather than to assert on the
method name you wanted to mock... could prevent a typo from messing up
tests.
* PR feedback: convert tests to integration-style tests
Set up a fake verisure hub, stub out a _lot_ of calls, then test
after platform discovery and service calls.
It should be noted that we're overriding the `update()` calls in
these tests. This was done to prevent even further mocking of
the verisure hub's responses.
Hopefully, this'll be a foundation for people to write more tests.
* more pr feedback
* Restore states through a JSON store
* Accept entity_id directly in restore state helper
* Keep states stored between runs for a limited time
* Remove warning
* Add workaround to use notification state for zwave lock state
There are several zwave lock models out there which do not seem to
update the lock state on non-rf events (see #11934#14632#14534 for
examples) including kwikset smartkey zwave plus locks (which I own).
In these cases it seems that the notifications for non-rf events the
access_control value is updated but not the primary value for the
lock state, which is what is used to set the is_locked property. To
properly have the lock state accurate for all types of notifications
on these models we need to use the access_control field. This commit
adds a workaround for the 4 models reported to exhibit this behavior
so that home-assistant will reliably set the lock state for all
device notifications.
* Add YRD220 as per adrum to workaround list
* Inline constants
Will set the available property to False if unable to communicate with August lock or doorbell.
HTTP request errors (i.e. timeout, connection error, HTTP error) will not result in traceback. Instead an error will be logged.
* Add doorsense sensor for August 3rd Gen Smart Lock Pro
Add a binary sensor to August for the August 3rd Gen Smart Lock Pro doorsense sensor.
This is a re-do from PR 17116 https://github.com/home-assistant/home-assistant/pull/17116 that I closed due to rebase issue on my end.
* Changed to use snjoetw provided code
Going through the py-august I found that snjoetw had provided updated versions for the august component (august.py and binary_sensor/august.py) to include DoorSense sensor.
Changed what I did to to what snjoetw provided instead as he split it into 2 classes; much cleaner I think.
I modified his coding with:
Fixes that were done to the August component and not part of the coding snjoetw provided.
Added the debug logging improvement I had done in the code.
Note, fix I committed earlier for lock atribute (lock/august.py) is thus still the same.
* Reverted change from add_device to add_entities
Missed an item when merging snjoetw's code with current. Fixed.
* Updated call from add_devices to add_entities as well
Updated the call from add_devices to add_entities.
* Fixed permissions on files
Fixed permissions on components/august.py and binary_snesor/august.py
* Changed if/else to if/continue
Changed logic so that if the door sensor state is unknown during initalization the debug log is written and then continue the loop instead of using if/else logic.
* Added available property for Door Sensor
Added the available property for the Door Sensor and setting it to False if a status unknown is received.
* Updated setting self._available
Changed line for setting self._available to what Martin provided. Much more efficient to read. :-)
* initial commit for kiwi door locks
bugfixes
improved attribute display
flake8
more style adjustments
* added session handling
flake8
* added requirements_all
reordered imports and flake8
attempt to pelase a very picky linter
also pleasing pylint now :)
* re-try the build
* added kiwi.py to .coveragerc
* reorganized datetime handling and attribute naming
* created pypi package for door lock library
* updated requirements_all.txt
* code review changes
* added async lock state reset for locking state
* refactored lat/lon attribute updates
* initial locked state changed from undefined to locked
* refactored is_locked property check
* handling authentication exception in setup_platform
* added more check in setup_platform
* code review changes: return type in setup_platform
* fixed logging issue
* event handling in main thread
* updated kiwiki-client to version 0.1.1
* renamed alias e to exc
* HomeMatic KeyMatic device become a real lock component
* Adds supported features to lock component.
Locks may are capable to open the door latch.
If component is support it, the SUPPORT_OPENING bitmask can be supplied in the supported_features property.
* hound improvements.
* Travis improvements.
* Improvements from review process
* Simplifies is_locked method
* Adds an openable lock in the lock demo component
* removes blank line
* Adds test for openable demo lock and lint and reviewer improvements.
* adds new line...
* Comment end with a period.
* Additional blank line.
* Mock service based testing, lint fixes
* Update description
* updated to new "b2vapi" of bimmer_connected
* updated requirements_all.txt
* updated 2 more vehicle names after rebase
* cleanup of import statements
* found one more broken name...
* removed unused constant
* cleanup of import statements 2
* Added extra sensors for BMW ConnectedDrive
* Updates based on review of @MartinHjelmare
* Updates based on 2nd review of @MartinHjelmare
* Changed control flow for updates to support updates triggered by remote services.
* updated library version number
* Changed order of commands so that the UI looks consistent.
State of lock is now set optimisitcally before getting proper update
from the server. So that the state does not toggle in the UI.
* Added comment on optimistic state
* Updated requirements_all.txt
* Revert access permission changes
* Fix for Travis
* Changes based on review by @MartinHjelmare
* Add support for August doorbell
* Address PR comment for August platform
* Address PR comment for August binary sensor
* Address PR comment for August camera
* Addressed PR comment for August lock
* - Fixed houndci-bot error
* - Updated configurator description
* - Fixed stale docstring
* Added august module to .coveragerc
* Upgrade pylint to 1.8.1
* Fix no-else-return
* Fix bad-whitespace
* Fix too-many-nested-blocks
* Fix raising-format-tuple
See https://github.com/PyCQA/pylint/blob/master/doc/whatsnew/1.8.rst
* Fix len-as-condition
* Fix logging-not-lazy
Not sure about that TEMP_CELSIUS though, but internally it's probably just like if you concatenated any other (variable) string
* Fix stop-iteration-return
* Fix useless-super-delegation
* Fix trailing-comma-tuple
Both of these seem to simply be bugs:
* Nest: The value of self._humidity never seems to be used anywhere
* Dovado: The called API method seems to expect a "normal" number
* Fix redefined-argument-from-local
* Fix consider-using-enumerate
* Fix wrong-import-order
* Fix arguments-differ
* Fix missed no-else-return
* Fix no-member and related
* Fix signatures-differ
* Revert "Upgrade pylint to 1.8.1"
This reverts commit af78aa00f125a7d34add97b9d50c14db48412211.
* Fix arguments-differ
* except for device_tracker
* Cleanup
* Fix test using positional argument
* Fix line too long
I forgot to run flake8 - shame on me... 🙃
* Fix bad-option-value for 1.6.5
* Fix arguments-differ for device_tracker
* Upgrade pylint to 1.8.2
* 👕 Fix missed no-member
* Lazy loading of service descriptions
* Fix tests
* Load YAML in executor
* Return a copy of available services to allow mutations
* Remove lint
* Add zha/services.yaml
* Only cache descriptions for known services
* Remove lint
* Remove description loading during service registration
* Remove description parameter from async_register
* Test async_get_all_descriptions
* Remove lint
* Fix typos from multi-edit
* Remove unused arguments
* Remove unused import os
* Remove unused import os, part 2
* Remove unneeded coroutine decorator
* Only use executor for loading files
* Cleanups suggested in review
* Increase test coverage
* Fix races in existing tests
* Huge ISY994 platform cleanup, fixes support for 5.0.10 firmware
# * No more globals - store on hass.data
# * Parent ISY994 component handles categorizing nodes in to Hass components, rather than each individual domain filtering all nodes themselves
# * Remove hidden string, replace with ignore string. Hidden should be done via the customize block; ignore fully prevents the node from getting a Hass entity
# * Removed a few unused methods in the ISYDevice class
# * Cleaned up the hostname parsing
# * Removed broken logic in the fan Program component. It was setting properties that have no setters
# * Added the missing SUPPORTED_FEATURES to the fan component to indicate that it can set speed
# * Added better error handling and a log warning when an ISY994 program entity fails to initialize
# * Cleaned up a few instances of unecessarily complicated logic paths, and other cases of unnecessary logic that is already handled by base classes
* Use `super()` instead of explicit base class calls
* Move `hass` argument to first position
* Use str.format instead of string addition
* Move program structure building and validation to component
Removes the need for a bunch of duplicate exception handling in each individual platform
* Fix climate nodes, fix climate names, add config to disable climate
Sensor platform was crashing when the ISY reported climate nodes. Logic has been fixed. Also added a config option to prevent climate sensors from getting imported from the ISY. Also replace the underscore from climate node names with spaces so they default to friendly names.
* Space missing in error message
* Fix string comparison to use `==`
* Explicitly check for attributes rather than catch AttributeError
Also removes two stray debug lines
* Remove null checks on hass.data, as they are always null at this point
* Call update on Sesame devices to cache initial state
* Switch to using async_add_devices
* Fix line length
* Fix Lint errors
* Fix more Lint errors
* Cache pysesame properties
* Updates from CR feedback
* Fire events for ISY994 control events
This allows hass to react directly to Insteon button presses (on switches and remotes), including presses, double-presses, and long holds
* Move change event subscription to after entity is added to hass
The event handler method requires `self.hass` to exist, which doesn't have a value until the async_added_to_hass method is called. Should eliminate a race condition.
* Overhaul binary sensors in ISY994 to be functional "out of the box"
We now smash all of the subnodes from the ISY994 in to one Hass binary_sensor, and automatically support both paradigms of state reporting that Insteon sensors can do. Sometimes a single node's state represents the sensor's state, other times two nodes are used and only "ON" events are sent from each. The logic between the two forunately do not conflict so we can support both without knowing which mode the device is in.
This also allows us to handle the heartbeat functionality that certain sensors have - we simply store the timestamp of the heartbeat as an attribute on the sensor device. It defaults to Unknown on bootup if and only if the device supports heartbeats, due to the presence of subnode 4.
* Parse the binary sensor device class from the ISY's device "type"
Now we automatically know which sensors are moisture, motion, and openings! (We also reverse the moisture sensor state, because Insteon reports ON for dry on the primary node.)
* Code review tweaks
The one material change here is that the event subscribers were moved to the `async_added_to_hass` method, as the handlers depend on things that only exist after the entity has been added.
* Handle cases where a sensor's state is unknown
When the ISY first boots up, if a battery-powered sensor has not reported in yet (due to heartbeat or a change in state), the state is unknown until it does.
* Clean up from code review
Fix coroutine await, remove unnecessary exception check, and return None when state is unknown
* Unknown value from PyISY is now -inf rather than -1
* Move heartbeat handling to a separate sensor
Now all heartbeat-compatible sensors will have a separate `binary_sensor` device that represents the battery state (on = dead)
* Add support for Unknown state, which is being added in next PyISY
PyISY will report unknown states as the number "-inf". This is implemented in the base ISY994 component, but subcomponents that override the `state` method needed some extra logic to handle it as well.
* Change a couple try blocks to explicit None checks
* Bump PyISY to 1.1.0, now that it has been published!
* Remove -inf checking from base component
The implementation of the -inf checking was improved in another branch which has been merged in to this branch already.
* Restrict negative-node and heartbeat support to known compatible types
Not all Insteon sensors use the same subnode IDs for the same things, so we need to use different logic depending on device type. Negative node and heartbeat support is now only used for leak sensors and open/close sensors.
* Use new style string formatting
* Add binary sensor detection for pre-5.x firmware
Meant to do this originally; writing documentation revealed that this requirement was missed!
* Updated to latest AbodePy version. Added services and events. Added new device types. Added exclude, light, and polling config options.
* Disable the event service if polling is enabled.
* Addressed all CR's
* Removed duplicated super call.
* Name config option now used. Removed deprecated DEFAULT_NAME.
* Modified partial to move event to first param.
* Updated abodepy version to 0.7.1
* Refactored to use AbodeDevice. Added Abode Lock device.
* Added push updates to abode devices.
* Upgraded to 0.7.2 after finding issue with callbacks.
* Refactored to use AbodeDevice. Added Abode Lock device.
* Added push updates to abode devices.
* Upgraded to 0.7.2 after finding issue with callbacks.
* Bumped version to 0.8.2. Modified code to work with new constants and properties. Added cover and switch.
* Fixed hound violations.
* Updated to 0.8.3 to fix small bug with standby mode. Fixed comment in cover/abode.py.
* Fix lint issues
* Removed excessive logging. Moved device callback registration to async_added_to_hass. Moved abode controller from global into hass data.
* Removed explicit None from dict.get()
* Move device class into the constructor.
* Changed constant name to platforms.
* Changes as requested.
* Removing stray blank line.
* Added blank line of which I'm not sure how it was removed.
* Updated version to 0.9.0. Fixed motion sensor. Added power_switch_meter device type.
* Update abode.py
* fix lint
* Update pysesame requirement to 0.1.0 to support caching
* Set `available` property based on API enabled status
* Add state attributes for device ID and battery level
* Refactor zwave discovery to entity schema
* Address PR concerns
* Split DISCOVERY_SCHEMAS into separate file
* Only check cover reverse workaround once
* Make zwave devices listen on less network changes.
* Convert more platforms
* Remove printouts.
* Fix copy-paste
* Change default dependent list to empty list
* Create zwave devices on OZW thread and only add them during discovery.
* Read and write devices dict from loop thread.
* More async
* replace callback with coroutine
* import common function instead of callin git
* First round of not using values directly
* Round two
* lint
* Round four
* Conflict
* Round five
* Update zwave.py
* round six
* Docstring
* flakywakie
* Fetch values in constructor
* Blank line removal
* Set attributes in callback
* Docstring
* Round seven
* Ughgit add homeassistant/components/lock/zwave.py!
* Sloppy code
* Support for Nuki.io smart locks
* Update requirements and add lock.nuki to .coveragerc
* lint: Re-organize imports
* Schedule a state update instead of calling directly update_ha_state
* Remove update requests altogether
* Make sure there is no IO inside properties
* Fix: nuki lock are all initialized as "lock.unnamed_device"
* Update pynuki to 1.2 to avoid an extra REST API call for each lock init
* Added door bell sensors
* Initial support for AC units.
* Added new device service
* Quirky Aros AC unit support
* Use super() everywhere and error checking for token request.
* Ignore camera sensors during setup of alarms.
* Added manufacturer/device attributes to all wink devices.
* Fixed style errors
* Fixed remaining lint errors.
* Update Command classes and device types to Sigma SDK
* Fix some pylint
* Seperate constants to file
* Flake8
* coverage and flake8 pylint
* Add services.yaml
* Service descriptions was missing
* Spelling :)
* grammar
* Remove zwave service descriptions from main
* Make sure values are updated regardles of manual or frontend update,
* Devices with set_switch command was not happy with fast updating.
* Binary triggersensors command was not happy with refreshed updating.
* Add power attribute to switch.
* Move device_state_attributes into base class.
* Fix imports following refactor.
* Bump pyvera version - should add contributed support for older (UI5) version dimmers and locks.
* Refactor device lookup to be based on vera classes, push category back into library.
* Add generic power attribute, fix inherited class order bug.
* Tidy.
* Replace switch with lock
* Update docstrings
* Add link to docs
* Add link to docs and update docstrings
* Update docstring
* Update docstrings and fix typos
* Add link to docs
* Add link to docs
* Add link to docs and update docstrings
* Fix link to docs and update docstrings
* Remove blank line
* Add link to docs
* Add tests to reach full coverage for helpers/state.py.
* Refactor reproduce_state function in helpers/state.py. Add two dicts,
as global constants, service_attributes and service_to_state. Use
these in combination with the dict of services per domain from
ServiceRegistry, to find the correct service to use in a scene state
change.
* Use break statement in for loop, to break if service was selected
to update state, in preference to update state attributes, ie state
update takes precedence.
* Add ATTR_CODE and ATTR_CODE_FORMAT in const. Import these in
alarm_control_panel and lock platforms instead of making duplicate
constants in multiple modules.
* Use ATTR_MEDIA_CONTENT_TYPE and ATTR_MEDIA_CONTENT_ID in media_player
platform in SERVICE_PLAY_MEDIA and play_media methods, instead of
'media_type' and 'media_id'.
* Fix PEP257 in modified files.