python-kasa/kasa/iot
Steven B 9cffbe9e48
Support child devices in all applicable cli commands (#1020)
Adds a new decorator that adds child options to a command and gets the
child device if the options are set.

- Single definition of options and error handling
- Adds options automatically to command
- Backwards compatible with `--index` and `--name`
- `--child` allows for id and alias for ease of use
- Omitting a value for `--child` gives an interactive prompt

Implements private `_update` to allow the CLI to patch a child `update`
method to call the parent device `update`.

Example help output:
```
$ kasa brightness --help
Usage: kasa brightness [OPTIONS] [BRIGHTNESS]

  Get or set brightness.

Options:
  --transition INTEGER
  --child, --name TEXT            Child ID or alias for controlling sub-
                                  devices. If no value provided will show an
                                  interactive prompt allowing you to select a
                                  child.
  --child-index, --index INTEGER  Child index controlling sub-devices
  --help                          Show this message and exit.
```

Fixes #769
2024-07-02 15:11:19 +02:00
..
modules Drop python3.8 support (#992) 2024-06-19 20:24:12 +02:00
__init__.py Update poetry locks and pre-commit hooks (#837) 2024-04-16 20:21:20 +02:00
effects.py Create common interfaces for remaining device types (#895) 2024-05-10 19:29:28 +01:00
iotbulb.py Add common energy module and deprecate device emeter attributes (#976) 2024-06-17 11:22:05 +01:00
iotdevice.py Require explicit feature type (#1006) 2024-06-25 18:30:36 +02:00
iotdimmer.py Fix set_state for common light modules (#929) 2024-05-22 15:33:55 +02:00
iotlightstrip.py Add some device fixtures (#948) 2024-06-04 19:24:53 +02:00
iotmodule.py Create common interfaces for remaining device types (#895) 2024-05-10 19:29:28 +01:00
iotplug.py Update documentation structure and start migrating to markdown (#934) 2024-06-03 10:14:10 +01:00
iotstrip.py Support child devices in all applicable cli commands (#1020) 2024-07-02 15:11:19 +02:00