core/homeassistant/components/switch
Nathan Henrie 2109b7a1b9 Use entity_id for backend, friendly name for frontend (#4343)
* 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
2016-11-12 22:46:23 -08:00
..
__init__.py Make services yield (#4187) 2016-11-03 18:32:14 -07:00
acer_projector.py Bugfix voluptuous acer_projector (#3598) 2016-09-29 18:36:20 -07:00
anel_pwrctrl.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
arduino.py Migrate to voluptuous (#3737) 2016-10-11 00:56:57 -07:00
arest.py Make services yield (#4187) 2016-11-03 18:32:14 -07:00
command_line.py Use entity_id for backend, friendly name for frontend (#4343) 2016-11-12 22:46:23 -08:00
demo.py Docstrings (#2502) 2016-07-12 16:46:29 +02:00
digital_ocean.py Component for Digital Ocean (#3322) 2016-09-30 18:30:44 +02:00
dlink.py D-Link switch version bump of external library (#4351) 2016-11-11 17:38:12 +01:00
edimax.py Use voluptuous for Edimax (#3178) 2016-09-04 19:17:40 -06:00
enocean.py Migrate to voluptuous (#2958) 2016-08-24 22:35:09 -06:00
flux.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
hikvisioncam.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
homematic.py cleanup Homematic code (#3291) 2016-09-09 19:33:12 +02:00
isy994.py Add ISY programs and support for all device types (#3082) 2016-09-11 20:18:53 +02:00
knx.py Use voluptuous for KNX (#3345) 2016-09-13 23:03:30 -07:00
litejet.py Async cleanup part 3 (#4302) 2016-11-07 22:31:40 -08:00
mfi.py Use setup_component in tests (#3414) 2016-09-17 10:29:58 -07:00
mochad.py Add mochad component (#3970) 2016-10-24 21:49:49 -07:00
modbus.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
mqtt.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
mysensors.py Fix mysensors overwriting gateway in GATEWAYS (#4013) 2016-11-06 10:49:43 -08:00
mystrom.py Clean-up, ordering, constants, and extend of schema (#2903) 2016-08-20 15:40:16 -07:00
neato.py Add support for Neato Connected robot as a switch (#3935) 2016-10-21 21:14:45 -07:00
netio.py Async cleanup part 3 (#4302) 2016-11-07 22:31:40 -08:00
orvibo.py Use constants (#3148) 2016-09-03 00:09:14 +02:00
pilight.py Change pilight systemcode validation to integer (#4286) 2016-11-10 13:14:40 -08:00
pulseaudio_loopback.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
qwikswitch.py Update Qwikswitch: fix typing, add validation, shutdown (#2603) 2016-07-23 17:03:29 -07:00
rest.py Fix rest switch default template (#4331) 2016-11-10 21:32:08 -08:00
rfxtrx.py Limit worker pool to 10 threads (#3560) 2016-09-28 00:05:38 -07:00
rpi_gpio.py Use voluptuous for RPi GPIO (#3371) 2016-09-17 23:28:37 -07:00
rpi_rf.py Disable too-many-* (#4107) 2016-10-30 22:18:53 +01:00
scsgate.py Use voluptuous for SCSGate (#3265) 2016-09-13 07:23:53 +02:00
services.yaml Add mysensors IR switch device and service (#2239) 2016-06-12 23:04:45 +02:00
tellduslive.py Fix PEP257 issues 2016-03-08 13:35:39 +01:00
tellstick.py Tellstick switch force update (#3874) 2016-10-16 15:56:55 -07:00
template.py Async cleanups with new handling and executor (#4234) 2016-11-06 01:01:03 +01:00
thinkingcleaner.py Fix PyLint 1.6 issues (#2471) 2016-07-07 18:54:16 -07:00
tplink.py Daily consumption information for HS110 (#4206) 2016-11-10 22:43:16 -08:00
transmission.py Clean-up, ordering, constants, and extend of schema (#2903) 2016-08-20 15:40:16 -07:00
vera.py Maintenance 2nd (#4106) 2016-10-30 09:58:34 +01:00
verisure.py Use voluptuous for Verisure (#3169) 2016-09-06 18:18:34 -07:00
wake_on_lan.py Add support for off script to WOL switch (#4258) 2016-11-09 08:44:30 -08:00
wemo.py Handle startup race condition. 2016-03-14 10:29:12 +00:00
wink.py Sensor updates (#3410) 2016-09-20 00:05:54 -07:00
zigbee.py Migrate to voluptuous (#3234) 2016-09-06 18:28:55 -07:00
zoneminder.py Maintenance zoneminder (#4102) 2016-10-29 13:10:42 -07:00
zwave.py Zwave: Update commandclasses and deviceclasses according to sigma SDK (#3495) 2016-09-30 08:43:18 -07:00