* First draft for cover component
* Efficiency from @martinhjelmare
* migrate demo
* migrate demo test
* migrate command_line rollershutter
* migrate command_line test
* migrate rpi_gpio garage_door
* make some abstract methods optional
* migrate homematic
* migrate scsgate
* migrate rfxtrx and test
* migrate zwave
* migrate wink
* migrate mqtt rollershutter and test
* requirements
* coverage
* Update mqtt with garage door
* Naming and cleanup
* update test_demo.py
* update demo and core
* Add deprecated warning to rollershutter and garage_door
* Naming again
* Update
* String constants
* Make sure set_position works properly in demo too
* Make sure position is not set if not available.
* Naming, and is_closed
* Update zwave.py
* requirements
* Update test_rfxtrx.py
* fix mqtt
* requirements
* fix wink version
* Fixed demo test
* naming
* Move secret cache out of loader so it can be referenced by other folders
* Unit test to verify secrets from another folder work & see if it overrides parent secret
* Clear secret cache after load
* Add action and callback support to html5 (#2855).
Remove registrations from the callback view since we always get the latest anyway.
We dont put an audience in the claims so we will never hit this error.
Bring tests back up to where they were before callbacks.
Only import jwt where necessary
Fix bracket spacing errors
Fix JWT decode check for loop
Remove stale comment.
Add tests for the callback system.
Shorten line
Disable pylint broad-except and change e to jwt_decode_error.
Verify expiration
Remove duplicate jwt.exceptions.DecodeError
Catch no keys matched and return False
* Switch to using registrations for callbackview instead of json_path
* Only check for URL and such if the data object actually exists
* raise instead of return
* cleanup decode_jwt
* Clean up JWT errors
* Correctly set status_code to 401
* Improve JWT by adding target to claims and attempting to check the given target for a decode match first, as well as pass the target through in the event payload.
* Add tag support and fix formatting issues
* Pass through any keys that dont apply to the payload into the notification.data dictionary
* Remove stale print
* Pass back the data dictionary if it exists
* Actually put the default url even if a notify payload dictionary doesnt exist
* pylint, flake8
* Add subscription validation
* Add validation for the callback event payload and use constants where possible
* Use HTTP_UNAUTHORIZED instead of 401
* Change callback dictionary to dict instead of cv.match_all
* Fix up tests and make subscription required
* Whoops, that test was supposed to fail
* Use the result of CALLBACK_EVENT_PAYLOAD_SCHEMA as event_payload
* Add a test for html5 callback decode_jwt where the device has been renamed since notification has been sent.
* Remove the loop through logic, assume that target is always in JWT
* Always return something instead of possibly None.
* Update frontend
* Add a group notify platform which allows sending a single notification to multiple platforms.
* Correctly sort group.py
* Clean up the payload logic
* Make name and entity id required in the schema
* Deep update the dictionary to fix a bug where data wasnt merging.
* Add notify.group tests.
* Improve docstrings.
* Change entities to services and entity_id to service
* Make service a slug without a default value
* Update tests for entities->services, entity_id->service
* vol.Any(cv.slug) -> cv.slug
* First pass on providing individual services for all possible targets that a notification platform supports.
* Add a quite hacky first version of notification groups
* Add a docstring for get_targets
* Register group service under notifygroup/ and safely check for notifygroups in config
* Remove notifygroups, because it belongs in its own PR
* Make @balloob requested changes
* get_targets()->targets
* Add tests for notify targets exposed as individual services
* If we dont have a platform name set in configuration, lets use the name of the platform instead of notify
* Fix test docstring.
* Dont use a dictionary for just one value
* No need to double slugify
* targets is now just a list of strings instead of a dict
* Support passing an email address linked to Gravatar as the picture in known_devices.
* Add a dedicated field for Gravatar
* Bring tests back up to where they were before Gravatar.
* Add tests for Gravatar.
* Retry sending the push for 1 day instead of failing instantly if the target is unavailable
* Add timestamp to push payload
* Correctly use the title and body fields for their intended purposes
* Add callback support
* Revert changes to frontend files.
* Add default URL which will open Home Assistant. Also put all the data into the data object of the payload so it is accessible in the browser. Without doing this, things like URL wouldnt be accessible.
* Flake8 and pylint fixes
* event->type
* Dont send the default url if actions exist
* flake8/pylint fixes again
* Update html5 tests
* Remove callbacks from this branch, will re-stage on a different branch
* Remove remnant of callbacks
* Add url to data dictionary if it exists instead of copying the entire data dictionary in
* flake8 fix
* Initial work to add Chrome Push Notification support
* Remove push.js from home-assistant since it is now in Polymer
* Chrome->HTML5, general cleanup/fixes
* Make html5 generic, move manifest.json into frontend so that we can dynamically add the gcm_sender_id
* Pylint, flake8, pydocstyle frontend init
* HTML5 push fixes
* Update polymer
* Remove crypto req
* Add notify default platform.
* Fix HTML5 push
* Registration fixes
* Linting fix
* pep257 fix
* Add tests
* pep257 fix
* Update frontend
* Add support for new mqtt_json light platform.
* Fix W503 errors.
* Bring in feedback from @balloob.
* Add test coverage for invalid color and brightness data.
* Add coverage for transition in turn_off.
* Added optional embedded image attachments to notify.smtp.
Also restructured a bit to minimize code duplication and add some tests.
* Fixed formatting errors.
* SMTP cleanups thanks to code review.
Add unit symbol constants
Initial unit system object
Import more constants
Pydoc for unit system file
Import constants for configuration validation
Unit system validation method
Typing for constants
Inches are valid lengths too
Typings
Change base class to dict - needed for remote api call serialization
Validation
Use dictionary keys
Defined unit systems
Update location util to use metric instead of us fahrenheit
Update constant imports
Import defined unit systems
Update configuration to use unit system
Update schema to use unit system
Update constants
Add imports to core for unit system and distance
Type for config
Default unit system
Convert distance from HASS instance
Update temperature conversion to use unit system
Update temperature conversion
Set unit system based on configuration
Set info unit system
Return unit system dictionary with config dictionary
Auto discover unit system
Update location test for use metric
Update forecast unit system
Update mold indicator unit system
Update thermostat unit system
Update thermostat demo test
Unit tests around unit system
Update test common hass configuration
Update configuration unit tests
There should always be a unit system!
Update core unit tests
Constants typing
Linting issues
Remove unused import
Update fitbit sensor to use application unit system
Update google travel time to use application unit system
Update configuration example
Update dht sensor
Update DHT temperature conversion to use the utility function
Update swagger config
Update my sensors metric flag
Update hvac component temperature conversion
HVAC conversion for temperature
Pull unit from sensor type map
Pull unit from sensor type map
Update the temper sensor unit
Update yWeather sensor unit
Update hvac demo unit test
Set unit test config unit system to metric
Use hass unit system length for default in proximity
Use the name of the system instead of temperature
Use constants from const
Unused import
Forecasted temperature
Fix calculation in case furthest distance is greater than 1000000 units
Remove unneeded constants
Set default length to km or miles
Use constants
Linting doesn't like importing just for typing
Fix reference
Test is expecting meters - set config to meters
Use constant
Use constant
PyDoc for unit test
Should be not in
Rename to units
Change unit system to be an object - not a dictionary
Return tuple in conversion
Move convert to temperature util
Temperature conversion is now in unit system
Update imports
Rename to units
Units is now an object
Use temperature util conversion
Unit system is now an object
Validate and convert unit system config
Return the scalar value in template distance
Test is expecting meters
Update unit tests around unit system
Distance util returns tuple
Fix location info test
Set units
Update unit tests
Convert distance
DOH
Pull out the scalar from the vector
Linting
I really hate python linting
Linting again
BLARG
Unit test documentation
Unit test around is metric flag
Break ternary statement into if/else blocks
Don't use dictionary - use members
is metric flag
Rename constants
Use is metric flag
Move constants to CONST file
Move to const file
Raise error if unit is not expected
Typing
No need to return unit since only performing conversion if it can work
Use constants
Line wrapping
Raise error if invalid value
Remove subscripts from conversion as they are no longer returned as tuples
No longer tuples
No longer tuples
Check for numeric type
Fix string format to use correct variable
Typing
Assert errors raised
Remove subscript
Only convert temperature if we know the unit
If no unit of measurement set - default to HASS config
Convert only if we know the unit
Remove subscription
Fix not in clause
Linting fixes
Wants a boolean
Clearer if-block
Check if the key is in the config first
Missed a couple expecting tuples
Backwards compatibility
No like-y ternary!
Error handling around state setting
Pretty unit system configuration validation
More tuple crap
Use is metric flag
Error handling around min/max temp
Explode if no unit
Pull unit from config
Celsius has a decimal
Unused import
Check if it's a temperature before we try to convert it to a temperature
Linting says too many statements - combine lat/long in a fairly reasonable manner
Backwards compatibility unit test
Better doc
This commit adds a new config option to the heat_control thermostat
component, min_cycle_duration. Some heaters and/or ACs don't like
being constantly cycled on and off. Prior to this patch the
heat_control component can end up cycling the switch quite
frequently. (depending on how quickly the temperature changes) The
new option added is used for setting a minimum duration that must
have elapsed in either the on or off state before the thermostat will
send the service call to cycle the switch. This should enable users to
hand tune how frequently heat_control can switch the device on or off
to best suit the device being used.
This commit adds a new option to the heat_control component, ac_mode.
When set to true, this treats the toggle device as a cooler instead
of a heater. The concept being if you have a window or in-wall ac
unit that doesn't have a built-in thermostat having the home assistant
implemented thermostat would be as useful as for space heaters.
* Added mired and kelvin mode to flux
* changed as requested
* Renamed varible
* attempt to add test for new method in flux.py
* removed line to fix lint error
* Allow multiple proximities
* Distance conversion
* Add unit of measurement and conversion to proximity
* Shorten attribute name
* Fix get unit of measurement
* Fix the km <-> m conversion
* Add type check and errors
* first path unit test around distance utility
* Fix numeric type check
* Fix conversion type-os
* Actually set the exception thrown flag
* Test for exact conversion
* More descriptive variable names
* Update method invocation to match change in method name
* Missed a couple variables
* Line continuation
* Fix linting too many return issue
* Break out proximity setup for list of proximity and for single proximity device
* Pass hass to setup function
* Check if setup succeeded for each proximity component
* Change variable name
* Break out branches in convert to avoid too many branches linting error
* Remove disable lint line
* Variables for default properties
* Combine logic
* Test loading multiple proximities for 100% code coverage on proximity component
* Unit test to reach 100%
Fail to configure proximities missing devices
* Fail first before processing
* Combine return statements
* lstrip = bad Teagan
* Utilize string formating instead of concatenation
* Fix variable reference
* Typeo
* Clean up conversion to reduce complexity
* Update unit tests to match code changes on distance util
* Test non numeric value
* Private methods, value type has already been checked.
* slugify() for dev_id (fixes#2162) [Keep space replacement to not impact known_devices.yaml]
* pyicloud upgrade 0.9.1
* config validation
* Only poll icloud every 4 minutes...
* Immediately pull device state on HASS start
* Added new test with icloud char e' acute [chr(233)]
* Suppress pyicloud logging
* Update recorder.
models.py:
- Use scoped_session in models.py to fix shutdown error
__init__.py:
- Session _commit & retry method
- Single session var for purge_data
- Ensure single _INSTANCE
- repeat purge every 2 days
- show correct time in log_error
* _commit
* Restore models to old functionality, swap purge, remove _INSTANCE cleanup from tests, typing ignore Base class
* pylint
* Remove recorder from model unit test
* Fix deprecated(moved) import
* Add util/dt typing
* Green on mypy util/dt
* Fix some errors
* First part of yping util/yaml
* Add more typing to util/yaml
* add media_player/clear_playlist and line-in/tv support to sonos
* add support source radio
* fix bug
* print TV/Line-In as media_title
* implement universal player
* add to demo platform
* Update demo.py
Better handling for demo object
* add unit tests
* fix unit test
* Update unifi.py
Add support for a site that is not the default within the Unifi Controller.
i.e. A controller with multiple sites:
- Home
- Friends
- Parents (default)
Supplying the identifier for 'Home' now means that the devices tracked will be associated with 'Home'.
* Update test_unifi.py
Fix test modules as well.
* Switch to SQLAlchemy for the Recorder component. Gives the ability to use MySQL or other.
* fixes for failed lint
* add conversion script
* code review fixes and refactor to use to_native() model methods and execute() helper
* move script to homeassistant.scripts module
* style fixes my tox lint/flake8 missed
* move exclusion up
Default behavior for warm/cold white channels is to assume the white
channel is mixed with the rgb. This is a sane default and should support
the Fibaro RGBW LED controller.
* Stick version numbers
* Move elevation to core config
* Migrate forecast test to requests-mock
* Migrate YR tests to requests-mock
* Add requests_mock to requirements_test.txt
* Move conf code from bootstrap to config
* More config fixes
* Fix some more issues
* Add test for set config and failing auto detect
This commit fixes an issue with the use of None in default values
for the config get() calls in __init__() of AsusWrtDeviceScanner.
These values are cast as strings and when a NoneType is cast it
returns the string "None" this broke the check for the existence
of these fields. This commit fixes the issue by changing the default
value to be an empty string '' which will conform with the behavior
expected by the ssh login code.
Closes#2343
* Added template rendering to `shell_command` component
* Security upgrades to template rendering in shell_command.
* Added new unit tests for shell_command templates.
Better failure when template is invalid in shell_command
* Refactor Forecast.io
* Some more refactoring and code review workoff
* Dict switch refactor
* CamelCase for data lookup
* Fixing unit_of_measure update
* Better default return for unit_of_measurement
* Test fix
* Removed webcolors dependency in favor of dictionary lookup.
* Fixed code style errors.
* Moved color dictionary to module per suggestion.
* Removed try/except per suggestion.
Unfortunately, Ubiquiti changed their (supposedly versioned) API in
3.2.0 which causes us to have to refer to cameras by id instead of
UUID. The firmware for 3.2.x also changed the on-camera login procedures
and snapshot functionality significantly.
This bumps the requirement for uvcclient to 0.9.0, which supports the
newer API and makes the tweaks necessary to interact properly.
* flux platform as a switch
* use track_time_change. broken :(
* use track_utc_time_change instead of track_time_change
* add some basic tests
* use brightness from RGB_to_xy
* config_schema validation
* back to platform schema. what was i doing?
* more broken tests :(
* 644
* fix some time bugs
* add working tests. config validation still not right
* bug fixes and more test cases.
* List entity_ids in config and only react to them
This allows us to define a list of entity_ids in the config to make the
template sensor, binary sensor and switch only react to state changes of
these entities instead of listening to all state changes.
* Forgot to import the track_state_change function
* Changed test for added entity_ids to config
* Use default MATCH_ALL and remove event_listener
* Allow time condition windows to cross midnight.
* Address comments.
Fold _in_time_window back into the time() condition test.
Use specific time values to test the time window.
* Add support for Logentries
Supports sending has events to Logentries web hook endpoint
see logentries.com for more
Inspired by the Splunk component
* bugfix
* fix summary
* fix test
* fix logentries url and tests
* update tests
* mock token
* Bug fixes
* typo
* typo
* fix string splitting
* remove redundant backslash
* Adds MoldIndicator sensor platform
This sensor may be used to get an indication for possible mold growth in rooms.
It calculates the humidity at a pre-calibrated indoor point (wall, window).
* Automatic conversion to Fahrenheit for mold_indicator
* Minor change to critical temp label
* Fixed docstrings and styles
* Minor changes to MoldIndicator implementation
* Added first (non-working) implementation for mold_indicator test
* Small style changes
* Minor improvements to mold_indicator
* Completed unit test for mold indicator
* Fix to moldindicator initialization
* Adds missing period. Now that really matters..
* Adds test for sensor_changed function
"unix" timestamp is number of seconds since Jan 1, 1970 UTC.
This allows scripts that use templates to generate time
deltas in seconds if desired from state attributes such
as last_updated.
Some examples:
timestamp now is
{{ as_timestamp(now) }}
timstamp of last change is
{{ as_timestamp(states.binary_sensor.garage_door.last_changed) }}
seconds since last change is
{{ as_timestamp(now) - as_timestamp(states.binary_sensor.garage_door.last_changed) }}
* Add STATE_UNAVAILABLE to states that are ignored when writing to the
database. This will avoid a field type error for string if the field
already contains a different type, eg integer.
* Add test for ignored states for influxdb.
* Clean up influxdb tests.
* Accept group without entities in configuration.
People seem to use these as placeholders for future expansion of their
home automation dreams, and we used to accept them. We still have to
specify at least one of 'name', 'view' or 'icon' so that the group is
parsed as a dictionary.
* Also accept empty entities: key in a group.
* Additional fix for empty entities value in a group config.
Two tests were invariably grinding my system to a halt as it was
applying migrations to an empty sqlite database. This patch reduces
the time of a pytest run from 50 to about 16 seconds on my desktop.
The difference is even more noticable on a slower laptop drive, but
is probably insignificant for all you fancy SSD users.
Accept delay configuration even when someone forgets to indent the time
specification.
Also removed 'weeks' and 'microseconds' from acceptable delay values.
There is a new homeassistant release every 2 weeks and running scripts
are not persisting across restarts. And there is still the option of
using (weeks*7) days if the long delay is really necessary.
And if someone really depends on microsecond delay precision we are
unlikely to be able to provide this accuracy, even milliseconds is
suspect for that matter but will at least allow us to specify some
subsecond delay.
The Updater component doesn't make much sense on dev versions. If you
want to run a production config with the updater enabled, you end up
with an 'Update Available' badge pointing you to the last release
version. This change disables the Updater component on dev and updates
the tests to use a faked version number.
A warning is emitted if the Updater component is disabled to ensure
there is no confusion.
Also fixes a bug where the test when no payload is given succeeds only
because we run the jinja templating out of memory. Sending an empty
payload instead of trying to fix it through validation for now.
* Service validation for MQTT component.
* Fixes for failing mqtt tests.
- Changed behaviour when both 'payload' and 'payload_template' are provided
instead of silently ignoring the payload_template value.
- Have validation accept any type of payload and leave encoding to paho-mqtt.
* Log error for services called without required attributes, in
media_player, notify and thermostat platforms.
* Add fan property and methods in thermostat demo component.
* Add tests for notify file and thermostat demo component.
* Increase coverage of tests for media_player, notify and thermostat
platforms.
* Fix some PEP issues, but not all. Tests still have old linting
errors.
* 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.
The default configuration of the mFi controller generates self-signed
certificates which are valid for short periods of time, and which are
regnerated on start or as needed. This makes requests mad. Since most
people will be using the self-signed certificates anyway, add options
to let them choose non-TLS, or unverified connections if they want/need.
This bumps the mficlient requirement to 0.3.0 for proper handling of
verify=False.
Converts 0..255 values that HA expects into a device 0..SCALE value
Example:
HA considers "hall light" at 25 brightness or 10% of 255
Device considers "hall light" at 100 brightness or 10% of 1000
This allows our existing MQTT devices to not change their data format to be used in HA
The exception we were catching incorrectly referenced the client variable
in local scope instead of the module. Also, if we fail to connect we can
get a requests exception, so catch and handle that as well.
The older (unsupported AirCam) models behave differently and also apparently
suffer some under the last release of the NVR that supported them. Since they
are EOL and not supported by current software, filter them out so we don't
break while trying to extract an image from them.
This adds tests for the uvc camera module. It's a good thing too,
because I found a few bugs which are fixed here as well:
- Graceful handling of non-integer port
- Failure to take the first host that works when probing host,internalHost
- Failure to detect if neither of them actually work
This also converts the code to only call add_devices once with a listcomp.
* Add mysensors binary sensor.
* Add discovery platforms to binary_sensor base component.
* Replace device_state_attributes with state_attributes in
binary_sensor base class.
* Fix docstrings.
* Add discovery of binary sensor to mysensors component.
* Add child.type as argument to mysensors device_class.
* Move binary sensor types from sensor to binary_sensor module.
* Fix binary_sensor attribute tests. Use state_attributes instead of
device_state_attributes.
Ubiquiti's Unifi WAP infrastructure has a central controller (like mfi and uvc)
that can be queried for client status. This adds a device_tracker module that
can report the state of any client connected to the controller.
This adds a 'sensor_class' property and attribute, which should be either
None or one of several defined SENSOR_CLASSES to indicate contextual
information about what the sensor is measuring.
* Make a flatter one level inheritance, with MySensorsLight as parent
with four children, one per light type.
* Break out helper methods. One per plain light, dimmer and RGB/RGBW
children and per update, turn_on and turn_off, nine in total. Put
these in the parent.
* Call the helper methods as needed from the child methods update,
turn_on and turn_off.
* Change name of MySensorsLightLight to MySensorsLightPlain.
* Fix module docstrings according to pep257.
* Change name of color util method from rgb_hex_to_list to
rgb_hex_to_rgb_list.
* Add unit tests for rgb_hex_to_rgb_list.
This bumps the somecomfort requirement to 0.2.1 to pull in a change
that makes handling no-fan systems graceful. Adds a test that should
prove it gives us what we want.
If no fan, then fan is always idle and fanmode is None.
This allows you to get every door, window, smoke, etc zone from your security
panel into HA. This uses the live eventing feature of pynx584, which means you
get instantaneous signaling into HA when a door opens or something happens,
which is handy for automating lights on when doors open after dark, etc.
Requires update to pynx584 0.2
This lets you optionally only add thermostats by location or
specific device id, instead of all the thermostats in your
account. This would be helpful if you have two devices in different
houses (i.e vacation home), etc.
This adds tests for the influxdb component. It also fixes a bug,
where username and password are required, but not gracefully
handled if they're missing from config.
This also fixes issue #1214, and I think another bug. The splunk
code will just take the value of state.state and try to serialize
it to json if it can't make it into a number. It did this before
I generalized that code. Since json.dumps() will fail on most anything
complicated, I think the right thing to do is *not* try to do that.
This adds state_as_number(), a helper method that tries to interpret
state as a number, for cases we can predict. It's a generalization of
what is copy-and-paste-ed into multiple other places.
Like recorder, this component listens to all events and reports any
that it can to a graphite installation. This makes it easy to use
graphite for all your data collection and analysis. If you run
carbon-cache (the backend for graphite) on the local machine, no
configuration is required other than enabling the component.
For more info on graphite: http://graphite.wikidot.com/
This adds a new function to history module which returns significant
states. For most domains this is the list of state changes. For the
thermostat domain this also includes attribute changes, so that
changes in the current_temperature are exposed to the graphing layer.
Closes#881