* Use entity_id for backend, friendly name for frontend
Closes https://github.com/home-assistant/home-assistant/issues/3434
Command line switches had the option to set a `friendly_name` reportedly
for use in the front end. However, if set, it was also being used as the
`entity_id`.
This did not seem like obvious behavior to me. This PR changes the
behavior so the entity_id is the object_id, which must already be
unique, and is an obvious place to have a very predictable slug (even if
long or unsightly), and the friendly name (if set) is used for the
display.
Example:
```yaml
switch:
platform: command_line
switches:
rf_kitchen_light_one:
command_on: switch_command on kitchen
command_off: switch_command off kitchen
command_state: query_command kitchen
value_template: '{{ value == "online" }}'
friendly_name: "Beautiful bright kitchen light!"
```
If you were using in an automation or from dev tools, would use:
`switch.rf_kitchen_light_one`, but your front end would still show `Beautiful
bright kitchen light!`
* Add new arg to test_assumed_state_should_be_true_if_command_state_is_false
* Import ENTITY_ID _FORMAT from existing, rename device_name to object_id
* Rename `device_name` to `object_id`
* Test that `entity_id` and `name` are set as expected
This feature needs to be enabled through the `http.use_x_forwarded_for` option,
satisfying security concerns of spoofed remote addresses in untrusted network
environments.
The testsuite was enhanced to explicitly test the functionality of the
header.
Fixes#4265.
Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
* Added some extra options to Weather Underground component
* Added Location and Elevation options
* Fixed if statement
* Fixed lint
* Updated tests including elevation and location
* Update wunderground.py
* 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/