From cfe565a8b276049feb3b00cbcd839078fbb9fcdd Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 31 May 2023 14:50:56 -0700 Subject: [PATCH] Add docs --- README.md | 20 +++++++++++++++++++ .../adaptive_lighting/_docs_helpers.py | 5 +++++ custom_components/adaptive_lighting/const.py | 12 +++++------ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1a0830b0..74adea61 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ The `adaptive_lighting.manual_control` event is fired when a light is marked as - [:memo: Options](#memo-options) - [:hammer_and_wrench: Services](#hammer_and_wrench-services) - [`adaptive_lighting.apply`](#adaptive_lightingapply) + - [`adaptive_lighting.turn_on`, `adaptive_lighting.turn_off`, `adaptive_lighting.toggle`](#adaptive_lightingturn_on-adaptive_lightingturn_off-adaptive_lightingtoggle) - [`adaptive_lighting.set_manual_control`](#adaptive_lightingset_manual_control) - [`adaptive_lighting.change_switch_settings`](#adaptive_lightingchange_switch_settings) - [:robot: Automation examples](#robot-automation-examples) @@ -176,6 +177,25 @@ adaptive_lighting: | `turn_on_lights` | Whether to turn on lights that are currently off. 🔆 | ❌ | bool | + + +#### `adaptive_lighting.turn_on`, `adaptive_lighting.turn_off`, `adaptive_lighting.toggle` + +`adaptive_lighting.turn_on`, `adaptive_lighting.turn_off`, `adaptive_lighting.toggle` turn Adaptive Lighting on or off. + +TODO: ... + + + + + + + + + + + + #### `adaptive_lighting.set_manual_control` `adaptive_lighting.set_manual_control` can mark (or unmark) whether a light is "manually controlled", meaning that when a light has `manual_control`, the light is not adapted. diff --git a/custom_components/adaptive_lighting/_docs_helpers.py b/custom_components/adaptive_lighting/_docs_helpers.py index 40afc235..2f8371cb 100644 --- a/custom_components/adaptive_lighting/_docs_helpers.py +++ b/custom_components/adaptive_lighting/_docs_helpers.py @@ -9,6 +9,7 @@ from .const import ( DOCS, DOCS_APPLY, DOCS_MANUAL_CONTROL, + SERVICE_TOGGLE_SCHEMA, SET_MANUAL_CONTROL_SCHEMA, VALIDATION_TUPLES, apply_service_schema, @@ -110,6 +111,10 @@ def generate_apply_markdown_table(): return _generate_service_markdown_table(apply_service_schema(), DOCS_APPLY) +def generate_turn_on_markdown_table(): + return _generate_service_markdown_table(SERVICE_TOGGLE_SCHEMA, DOCS_APPLY) + + def generate_set_manual_control_markdown_table(): return _generate_service_markdown_table( SET_MANUAL_CONTROL_SCHEMA, DOCS_MANUAL_CONTROL diff --git a/custom_components/adaptive_lighting/const.py b/custom_components/adaptive_lighting/const.py index babea0a5..df159b4b 100644 --- a/custom_components/adaptive_lighting/const.py +++ b/custom_components/adaptive_lighting/const.py @@ -211,12 +211,12 @@ DOCS[CONF_WHICH_SWITCH] = ( "Which switch to target in this service call. Options: " '"main" (default, targets the main switch), "sleep", "brightness", "color"' ) -DOCS[ - SERVICE_TURN_ON -] = "Turn on an Adaptive Lighting main/sleep/brightness/color switch" -DOCS[ - SERVICE_TURN_OFF -] = "Turn off an Adaptive Lighting main/sleep/brightness/color switch" +DOCS[SERVICE_TURN_ON] = ( + "Turn on an Adaptive Lighting" " main/sleep/brightness/color switch" +) +DOCS[SERVICE_TURN_OFF] = ( + "Turn off an Adaptive Lighting" " main/sleep/brightness/color switch" +) DOCS[SERVICE_TOGGLE] = "Toggle an Adaptive Lighting main/sleep/brightness/color switch" TURNING_OFF_DELAY = 5