* Updated Emulated_Hue to send request info as variables to scripts
* Updated tests to not use the old mqtt
* Updated test to actualy use and validate the script variables
* Fixed the removal of time in a recent merge
* fixed test to not use a timer
* Bugfix windows have a other default loop now
* fix handling with 3.4.2 that not support ensure_future
* make the same as ensure_future does
* fix spell
* fix lazy test
* Add a method to throttle calls to services
This adds CallRateDelayThrottle. This is a class that provides an
decorator to throttle calls to services. Instead of the Throttle in
homeassistant.util it does this by delaying all subsequent calls
instead of just dropping them. Dropping of calls would be bad if we
call services to actual change the state of a connected hardware (like
rf controlled power plugs).
Ihe delay is done by rescheduling the call using
track_point_in_utc_time from homeassistant.helpers.event so it should
not block the mainloop at all.
* Add unittests for CallRateDelayThrottle
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
* Introduce a send_delay for pilight component
If pilight is used with a "pilight USB Nano" between the daemon and the
hardware, we must use a delay between sending multiple signals.
Otherwise the hardware will just skip random codes. We hit this
condition for example, if we switch a group of pilight switches on or
off. Without the delay, random switch signals will not be transmitted by
the RF transmitter.
As this seems not necessary, if the transmitter is directly connected
via GPIO, we introduce a optional configuration to set the delay.
* Add unittests for pilight send_delay handling
This adds an unittest to test the delayed calls to the send_code
service.
* Sonos responsiveness improvements (async_ coroutines, event based updating, album art caching) + Better radio station information
* Docstring fixes.
* Docstring fixes.
* Updated SoCo dependency + fixed file permissions.
* Only fetch speaker info if needed.
* PEP8 fixes
* Fixed SoCoMock.get_speaker_info to get test to pass.
* Regenerated requirements_all.txt + async fetching of album art with caching + added http_session to HomeAssistant object.
* Unit test fixed.
* Add blank line as per flake8
* Fixed media image proxy unit test.
* Removed async stuff.
* Removed last remnants of async stuff.
* Lazy initialise the worker pool
* Minimize pool initialization in core tests
* Fix tests on Python 3.4
* Remove passing in thread count to mock HASS
* Tests: Allow pool by default for threaded, disable for async
* Remove JobPriority for thread pool
* Fix wrong block_till_done
* EmulatedHue: Remove unused test code
* Zigbee: do not touch hass.pool
* Init loop in add_job
* Fix core test
* Fix random sensor test
* Use unix newlines on test_emulated_hue
This commit switches the test_emulated_hue module to use unix newlines
instead of the DOS style that were there before. (using dos2unix on
the file) This makes it consistent with the other files in the repo.
* Cleanup emulated_hue tests
Previously these tests relied on the mqtt light platform as test devices
to control with the emulated hue. However, this was pretty heavyweight
and required running an MQTT broker in the tests. Instead this commit
switches it to use the demo light platform which is strictly in memory.
Fixes#3549
* Sonos improvements: media_* properties delegate to coordinator if speaker is a slave, media_image_url and media_title now works for radio streams, source selection/list takes speaker model into account, commands on slaves delegate to coordinator.
* Fixed failing unit tests.
* BUG Message data cannot be changed thus use voluptuous to ensure format
* Pilight daemon expects JSON serializable data
Thus dict is needed and not a mapping proxy.
* Add explanation why dict as message data is needed
* Use more obvious voluptuous validation scheme
* Pylint: Trailing whitespace
* Pilight sensor component
* Python 3.4 compatibility
* D202
* Use pytest-caplog and no unittest.TestCase
* Fix setup/teardown of unittests
* Activate coverage testing
* Bugfix whitelist filter and use bugfixed pilight library
* Use newest pilight library that has a bugfix
* Add unittest for pilight hub component
* PEP257 for docstrings
* Bugfix setting device name from host name and small cleanup
- Init with connection error handling is more clear
- Comments clean-up
* PEP257
* New unittest with full coverage
* Upload missing testfixtures
* D209
* Handle double quotes in reply
* Formatting
This commit adds a new component for communicating with mochad[1] a
socket interface for the CM15A and CM19A USB X10 controllers. This
commit leverages the pymochad library to interface with a mochad socket
either on a local or remote machine. Mochad is added as as a generic
platform because it supports multiple different classes of device,
however in this patch only the switch device implemented as a starting
point. Future patches will include other devices types. (although
that's dependent on someone gaining access to those)
[1] https://sourceforge.net/projects/mochad/
* Adds support for Pioneer AVR interface port number
https://community.home-assistant.io/t/support-for-pioneer-avr/503
telnetlib supports a port number so adding port as
an optional config element with a default of 23 resolves this.
* Adds timeout to Pioneer AVR
timeout in telnetlib defaults to socket._GLOBAL_DEFAULT_TIMEOUT
which is not a value, but rather a bare Object used for comparison.
telnetlib says the following about the timeout optional argument:
"The optional timeout parameter specifies a timeout in seconds
for blocking operations like the connection attempt (if not
specified, the global default timeout setting will be used)."
From the documentation for sockets:
"Sockets are by default always created in blocking mode"
Catching connect and timeout errors, logging to debug
and continuing.
* Catches timeout exceptions, logs and continues.
* Pilight daemon expects JSON serializable data. Thus dict is needed and not a mapping proxy.
* Add explanation why dict as message data is needed
* Use pytest-caplog and no unittest.TestCase
* added push notification implementation
* some lint changes
* added docs
* added push notification implementation
* some lint changes
* added docs
* Fixed comment formatting issues
* Added requirments
* Update requirements_all.txt
* Update apns.py
* re-generated requirments_all.txt
* Added link to online docs
* added push notification implementation
* some lint changes
* added docs
* added push notification implementation
* some lint changes
* added docs
* Fixed comment formatting issues
* Added requirments
* Update requirements_all.txt
* Update apns.py
* re-generated requirments_all.txt
* Added link to online docs
* changed to use http/2 library for push notifications
* fixed lint issue
* fixed test that fails on CI
* another go at fixing test that fails on CI
* another go at fixing test that fails on CI
* another go at fixing test that fails on CI
* added missing docstring
* moved service description to main services.yaml file
* renamed apns service
If a mock's assert_called_once_with method is misspelled (e.g. asert_called_once_with) then the test will appear as passing. Therefore, this commit removes all instances of assert_called_once_with calls and replaces them with two assertions:
self.assertEqual(mock.call_count, 1)
self.assertEqual(mock.call_args, mock.call(call_args))
* first version
* First draft component entities
* Change add_entities to callback from coroutine
* Fix bug add async_prepare_reload
* Group draft v1
* group async
* bugfix
* bugfix v2
* fix lint
* fix extract_entity_ids
* fix other things
* move get_component out of executor
* bugfix
* Address minor changes
* lint
* bugfix - should work now
* make group init async only
* change update handling to old stuff
* fix group handling, remove generator from init
* fix lint
* protect loop for spaming with updates
* fix lint
* update test_group
* fix
* update group handling
* fix __init__ async trouble
* move device_tracker to new layout
* lint
* fix group unittest
* Test with coroutine
* fix bug
* now it works 💯
* ups
* first part of suggestion
* add_entities to coroutine
* change group
* convert add async_add_entity to coroutine
* fix unit tests
* fix lint
* fix lint part 2
* fix wrong import delete
* change async_update_tracked_entity_ids to coroutine
* fix
* revert last change
* fix unittest entity id
* fix unittest
* fix unittest
* fix unittest entity_component
* fix group
* fix group_test
* try part 2 to fix test_group
* fix all entity_component
* rename _process_config
* Change Group to init with factory
* fix lint
* fix lint
* fix callback
* Tweak entity component and group
* More fixes
* Final fixes
* No longer needed blocks
* Address @bbangert comments
* Add test for group.stop
* More callbacks for automation
* Added the ability to Weather Underground to track severe weather alerts
* * Added message on the advisory attr
* Updated tests
* * Making use of guard clause
* Checking multiple_alerts prior loop
* Using a better way to create dict
* Fixed issue to set to None only the object that failed
* Added unittest
* Split update() method to different calls with their one throttle control to minimize API calls
* Updated unittest and make sure the alert sensor will not return 'unknown' status'
* Removed update() method from state property
* Branch rebased and include Weather Underground attribution
* Update wunderground.py
* Relaxes the configuration options for influxdb
By default influxdb allows unauthenticated access
Home Assistant required at least username and password to be present to properly submit data to influxdb
* Removes unused import of 'copy'
The copy module was used only in the removed test case responsible for testing the missing keys
* Updates InfluxDB config schema to require user and password
Current InfluxDB (v 1.0) can work without any authentication, but when authentication is enabled both username and password should be set.
* Removes extra white space in test_influxdb.py
* added error handling to mqtt message receive if payload is not utf-8 unicode
added mqtt test for above code as well
* change permission back to 644
* attempting to test new code
* changed exception to AttributeError
fixed test for above
* fixed lint errors I made in tests....mqtt/test_init.py
* more lint fixes for my added test
* remove dual decode of MQTT payload
* convert if to try, except, else statement for mqtt payload decode
* rework mqtt unicode testing code to properly check for log file entriy on unicode decode exception
* fixed lint error
* Update test_init.py
* Add Alexa Flash Briefing Skill API support
* Set default value for text to empty string as per API docs
* Clean up existing Alexa tests
* Update configuration parsing and validation
* Add tests for the Flash Briefing API
* Update test_alexa.py
* added include and exclude functionality to history component
* fixed summary lines in test method doc.
* cleanup of query filter creation
* o improved config validation
o move move IGNORE_DOMAINS to Filter.apply()
o removed config from Last5StatesView
o Filters instance is now created on setup
o config values are processed in setup and set to the Filters instance
o function _set_filters_in_query() moved to Filters class and renamed to apply()
* added unittests for more include/exclude filter combinations
* make pylint happy
* Fixes an issue where Chromecast audio groups were not properly discovered
* Forgot to commit the main fix
* Removes unused variable
* Doesn't use a protected API anymore
* PR remarks
* Fixes tests, adds comment
* Restores line as it was in the original commit, rephrases comment
* Should fix lint issues
* Trailing whitespace
* Some more lint
* Separate platform and presentation units in climate
* Fix unit tests
Maybe
* Fix unit tests some more
Maybe
* Rename _platform_unit_of_measurement to temperature_unit
* Fix tests for renamed attribute
* Cache condition in helpers.Script
The caching is a simple in-memory, per-instance dictionary.
We use __str__ to format cache keys.
This naive implementation has some disadvantages (e.g., we won't be able
to cache two conditions that contain references to
distinct-but-equivalent object instances and we don't have any control
over the size of the condition cache), but for most simple use-cases the
approach should be good enough.
Resolves#3629
* Fix docstring style
* Change approved_ips from string to cidr validation
Relabel to trusted_networks, better reflecting its expected inputs,
everything that ipaddress.ip_networks recognizes as an ip network
is possible:
- 127.0.0.1 (single ipv4 addresses)
- 192.168.0.0/24 (ipv4 networks)
- ::1 (single ipv6 addresses)
- 2001:DB8::/48 (ipv6 networks)
* Add support for the X-Forwarded-For header
* Rename Forecast.io platform to Dark Sky
* Upgrade to python-forecastio to 1.3.5
* Update to reflect name change (Forecast.io -> Dark Sky)
* Rename forecast to darksky
* Bugfix signhandling/services
* change from coroutine to callback
* add error handling
* fix bug with endless running
* fix unit test
* Revert "fix unit test"
This reverts commit 31135c7709.
* Disable sigterm/sighup test
* Add async_safe annotation
* More async_run_job
* coroutine -> async_save
* Lint
* Rename async_safe -> callback
* Add tests to core for different job types
* Add one more test with different type of callbacks
* Fix typing signature for callback methods
* Fix callback service executed method
* Fix method signatures for callback
* Template platforms: create_task instead of yield from
* Automation: less yielding, more create_tasking
* Helpers.script: less yielding, more create_tasking
* Deflake logbook test
* Deflake automation reload config test
* MQTT: Use async_add_job and threaded_listener_factory
* Deflake other logbook test
* lint
* Add test for automation trigger service
* MQTT client can be called from within async
commit 220331260e9748ac8e17b3ce776330c1dfb7725b
Merge: 73d93e5c891820
Author: Robbie Trencheny <me@robbiet.us>
Date: Sun Oct 2 17:57:24 2016 -0700
Merge branch 'color_temp_for_mqtt_light' of https://github.com/alterscape/home-assistant into alterscape-color_temp_for_mqtt_light
commit c89182008a
Author: Ryan Spicer <ryanspicer@gmail.com>
Date: Sun Sep 18 23:06:34 2016 -0700
fix missing docstring.
commit e61dda4dd3
Author: Ryan Spicer <ryanspicer@gmail.com>
Date: Sun Sep 18 22:43:04 2016 -0700
fix pep8 errors and typos in tests.
commit 559d1752d2
Author: Ryan Spicer <ryanspicer@gmail.com>
Date: Sun Sep 18 21:41:07 2016 -0700
add tests for mqtt color temp support
commit 702defb932
Author: Ryan Spicer <ryanspicer@gmail.com>
Date: Sun Sep 18 20:55:07 2016 -0700
Add color temp support to mqtt lights.
* Make flux always adjust brightness of light (even when not in XY mode)
* Remove kelvin mode from flux switch
The light/turn_on service only works with mired values, kelvin values
are out of range per the schema.
* Use already defined min/max values for light/turn_on schema
* Clamp temp value to light/turn_on allowed values
* Update notify to expect a list of string targets instead of a single string
* Actually do the thing I set out to do
* Fix notify.group test to expect an array of targets
* REST platform will only use the first target in the list
* Update notify platforms to expect a list of targets
* Update notify services.yaml
* Skip RFXtrx tests unless RFXTRX=RUN
* Remove my previous hacks to slightly speed up rfxtrx
* Exclude RFXTRX tests from coverage
* Remove unused import in rfxtrx tstt
* Add close connection back to RFXtrx tests
* Typo
* Update ecobee to use only range setpoints
* Update nest to only use range setpoints
* Update demo to use only range for ecobee test device
* Update test
* Fetch unit from ecobee
* generic_thermostat did not have state
* generic_thermostat test update
* Platform schema had duplicate retain keys, which made it always set
to default.
* Optimistic state changed was inverted, due to using integer position
instead of boolean.
* Add more tests for mqtt cover.
* Update __init__.py
addedattribute "WHITE_VALUE" to improve support for RGBW devices
* Update services.yaml
* Update __init__.py
* Update __init__.py
* Update __init__.py
* Update __init__.py
* Update __init__.py
* Update __init__.py
shortened line
* Update __init__.py
* Update __init__.py
* Add mysensors RGBW and light tests
* Activate support for mysensors RGBW devices with support for
white_value attribute.
* Add white_value support in light demo platform.
* Add tests for white_value and more for light component.
* Add tests for light demo platform.
* Fix import order in check_config.
* o added ability to exclude entities or domains from logbook
o exclude hidden entities
* fixed remaned configuration key
* - filter the events before they get passed to humanify, to separate concerns
- instead of looking at customize, look for the hidden attribute on the state change events
- access to configuration defaults to an empty list - no need to check
* - filter only events of type EVENT_STATE_CHANGED
- improve config handling
* added unit tests to cover all filter cases and logbook message creation
* Added email component
* added email sensor component
* added doc string to test class
* fixed lint error
* fixed lint error
* rename of email component
* added another block as test fails on CI
* added retry to multi email test
* added delay to retry
* added to .coveragerc
* removed sleep from tests and fixed up stale comments
* Move worker pool monitoring to be time based instead of add_job based.
* Stub out worker pool monitor during tests
* Add test for monitor worker pool.
* Improve naming
* Test stop_monitor coroutine
* Add async_create_timer test
* Finish rename create_timer
* Fix test shutdown to ensure loop/threads are clean.
We now ensure the loop is closed, it has completed, and the
executer has completed. This ensure all threads are freed
up with any test calling hass.stop().
* Fix lint issue with run_loop
* Test updating automatic
* Scan interval
* Schedule scan every time delta
* Pass around has
* Recursive issue
* Method invocation
* Oops
* Set up poll
* Default argument value
* Unused import
* Semicolon
* Fix tests
* Linting
* Unneeded throttle as it's handled by time event
* Use track time change event listener
* Disable lint rule
* Attribute removed - removing test
* Debug instead of info
* Unused import
* Add event loop to the core
* Add block_till_done to HA core object
* Fix some tests
* Linting core
* Fix statemachine tests
* Core test fixes
* fix block_till_done to wait for loop and queue to empty
* fix test_core for passing, and correct start/stop/block_till_done
* Fix remote tests
* Fix tests: block_till_done
* Fix linting
* Fix more tests
* Fix final linting
* Fix remote test
* remove unnecessary import
* reduce sleep to avoid slowing down the tests excessively
* fix remaining tests to wait for non-threadsafe operations
* Add async_ doc strings for event loop / coroutine info
* Fix command line test to block for the right timeout
* Fix py3.4.2 loop var access
* Fix SERVICE_CALL_LIMIT being in effect for other tests
* Fix lint errors
* Fix lint error with proper placement
* Fix slave start to not start a timer
* Add asyncio compatible listeners.
* Increase min Python version to 3.4.2
* Move async backports to util
* Add backported async tests
* Fix linting
* Simplify Python version check
* Fix lint
* Remove unneeded try/except and queue listener appproriately.
* Fix tuple vs. list unorderable error on version compare.
* Fix version tests
* Allow reloading groups without restart
* Test to make sure automation listeners are removed.
* Remove unused imports for group tests
* Simplify group config validation
* Add prepare_reload function to entity component
* Migrate group to use entity_component.prepare_reload
* Migrate automation to use entity_component.prepare_reload
* Clean up group.get_entity_ids
* Use cv.boolean for group config validation
If mFi sensors are identified but not fully assigned they can
have no tag value, and mficlient throws a ValueError to signal this.
This patch handles that case by considering such devices to always
be STATE_OFF.
* Update attr to property and default state method
* State prop is defined in parent class
* Demo platform fan
* PyDoc
* Copy-pasta artifact
* PyDoc
* Linting
* Raise error if turn_off and turn_on not implemented
* Update demo platform
* Initial unit test commit
* Readability
* Unneeded typing
* Should inherit from fan entity
* Turn off polling
* Initial oscillating flag
* Pass HASS into demo
* Typing
* Invoke set_speed instead of setting directly
* Service update
* Update demo tests
* Forgot to block after service call.
* linting
* Test to make sure not implemented is thrown
* Is On Method test
* Update const to match string
* Update services yaml
* Toggle method
* Toggle service
* Typing
* TYPE O
* Attribute check
* Type-o
* Type-o
* Put typing back
* ToggleEntity
* Linting
* Linting
* Oops
* Stale prints
* Demo support
* Initial code for alexa_local_control.
* Added support for creating a dummy username.
* Move SSDP responses to local variables.
* Added config validation via Voluptuous.
* Modify and remove unnecessary returned emulated bridge values.
* Remove script and scene domains from default exposed domains.
* Replaced Flask with HomeAssistantWSGI.
* Fix lint errors.
* Correcting grammar and spelling in docs and comments.
* Rename alexa_local_control to emulated_hue.
* Rename emulated_hue attributes.
* Fix a bug where something marked not exposed is exposed by default.
* Make sure the UPNP responder thread cleanly stops when HASS stops.
Also fix some config loading and lint errors.
* Fixed unexposed entities still having individual state exposed.
* Started writing tests for emulated_hue.
* Fix being able to set state of non-exposed entity.
* Another test for emulated_hue.
* More tests for emulated_hue.
Also slightly simplified emulated_hue's PUT handler.
* Fix bad test, sorry :/
* Third time's the charm.
* Fix lint and value validation tests.
* Rename emulated_hue bridge name.
* Remove license and documentation from header.
* Combine two if statements.
* Style changes.
* Fixed various issues and added some constants