From 8b7fcf2313b95c485599f579ee1376c2d105500f Mon Sep 17 00:00:00 2001 From: Guillermo Ruffino Date: Tue, 24 Jan 2023 14:56:46 -0300 Subject: [PATCH] Format-fixes-202211 (#2461) --- components/climate/bedjet.rst | 2 +- components/display_menu/index.rst | 28 ++++++++++++----------- components/display_menu/lcd_menu.rst | 26 ++++++++++++--------- components/ezo_pmp.rst | 34 ++++++++++++++-------------- components/sensor/ble_client.rst | 30 ++++++++++++------------ components/sensor/ezo.rst | 29 +++++++++++++----------- components/sensor/mpl3115a2.rst | 6 ++--- components/sensor/ufire_ec.rst | 12 +++++----- components/sensor/ufire_ise.rst | 18 +++++++-------- components/touchscreen/xpt2046.rst | 2 +- schema_doc.py | 32 ++++++++++++++++++++++---- 11 files changed, 125 insertions(+), 94 deletions(-) diff --git a/components/climate/bedjet.rst b/components/climate/bedjet.rst index b092eaf61..f3486012c 100644 --- a/components/climate/bedjet.rst +++ b/components/climate/bedjet.rst @@ -124,7 +124,7 @@ Configuration variables: ``bedjet`` Fan -------------- -The `fan` platform exposes the BedJet's fan-related functionality, including +The ``fan`` platform exposes the BedJet's fan-related functionality, including on/off and speed control. When the BedJet is already on, turning the Fan component off will set the BedJet unit's mode to diff --git a/components/display_menu/index.rst b/components/display_menu/index.rst index 3f0e4d54e..752c2ae94 100644 --- a/components/display_menu/index.rst +++ b/components/display_menu/index.rst @@ -79,15 +79,17 @@ Configuration variables: - **root_item_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the root menu item. - **active** (*Optional*, boolean): Whether the menu should start as active, meaning accepting user interactions and displaying output. Defaults to ``true``. -- **mode** (*Optional*, string): Defines the navigation logic. The ``rotary`` mode expects - the clockwise movement wired to :ref:`display_menu.down `, - the anticlockwise one to :ref:`display_menu.up ` and the switch - to :ref:`display_menu.enter ` action. The ``joystick`` mode - expects the up, down, left and right buttons wired to the :ref:`display_menu.up `, - :ref:`display_menu.down `, :ref:`display_menu.left ` - and :ref:`display_menu.right ` actions and the middle button - to the :ref:`display_menu.enter ` action. Defaults to ``rotary``. -- **menu** (**Required**): The first level of the menu. +- **mode** (*Optional*, enum): Defines the navigation logic. Defaults to ``rotary``. + + - ``rotary``: Rotary mode expects the clockwise movement wired to :ref:`display_menu.down `, + the anticlockwise one to :ref:`display_menu.up ` and the switch + to :ref:`display_menu.enter ` action. + - ``joystick``: Joystick mode expects the up, down, left and right buttons wired to the :ref:`display_menu.up `, + :ref:`display_menu.down `, :ref:`display_menu.left ` + and :ref:`display_menu.right ` actions and the middle button + to the :ref:`display_menu.enter ` action. + +- **items** (**Required**): The first level of the menu. Automations: @@ -100,7 +102,7 @@ Automations: Menu Items ---------- -The component manages a hierarchy of menu items. The common configuration variables are: +The component manages a hierarchy of menu items. The common configuration variables are: - **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. - **type** (**Required**, string): The type of the menu item (see below). @@ -172,7 +174,7 @@ is clicked the display shows the new menu level. Configuration variables: -- **menu** (**Required**): Defines the child menu items. +- **items** (**Required**): Defines the child menu items. Automations: @@ -383,7 +385,7 @@ Command text: 'Hide' on_value: then: - - display_menu.hide: + - display_menu.hide: The menu item of the type ``command`` allows triggering commands. There is no additional configuration. @@ -452,7 +454,7 @@ This automation will be triggered when the menu level is entered, i.e. the compo draws its items on the display. The ``it`` parameter points to a ``MenuItem`` class with the information of the menu item describing the displayed child items. If present at the top level it is an internally generated root menu item, -otherwise an user defined one. +otherwise an user defined one. .. code-block:: yaml diff --git a/components/display_menu/lcd_menu.rst b/components/display_menu/lcd_menu.rst index c254331e7..676c6d474 100644 --- a/components/display_menu/lcd_menu.rst +++ b/components/display_menu/lcd_menu.rst @@ -8,8 +8,8 @@ LCD Menu :image: lcd_menu.png The component provides an infrastructure for setting up a hierarchical menu -on character based LCD displays. This offers the user an interactive method to display -labels, control entities like ``switch``, ``select``, ``number`` available locally on the +on character based LCD displays. This offers the user an interactive method to display +labels, control entities like ``switch``, ``select``, ``number`` available locally on the ESPHome node, without the requirement of a network connection. .. figure:: images/lcd_menu.png @@ -24,9 +24,9 @@ a hierarchical menu primarily intended to be controlled either by a rotary encod with a button or a five-button joystick controller. The component needs to be connected to an instance of a character based LCD display, which -like :ref:`lcd-pcf8574` or :ref:`lcd-gpio`. For the best results the GPIO connection is -recommended; the I²C one running at the speed according to the datasheet (usually ``100`` -kHz) or even ESPHome default (``50`` kHz) will create perceptible delays especially when +like :ref:`lcd-pcf8574` or :ref:`lcd-gpio`. For the best results the GPIO connection is +recommended; the I²C one running at the speed according to the datasheet (usually ``100`` +kHz) or even ESPHome default (``50`` kHz) will create perceptible delays especially when changing a numeric value using the rotary encoder. Most ``PCF8574`` adapters used with these displays will happily run at ``200`` or even ``400`` kHz though so if you are comfortable accepting risks from running your hardware out of spec, you might want to try that @@ -94,12 +94,16 @@ Configuration variables: - **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation. - **display_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the LCD display. -- **mark_back**, **mark_selected**, **mark_editing**, **mark_submenu** (*Optional*, 0-255): - Code of the character used to mark menu items going back one level, a selected one, - the editing mode and item leading to a submenu. Defaults to ``0x5e`` (``^``), ``0x3e`` (``>``), - ``0x2a`` (``*``) and ``0x7e`` (a right arrow). As the character set lacks a good looking - back arrow, using a user defined character is advisable for ``mark_back`` (use ``8`` to - reference one at position ``0`` to avoid problems with zeros in a string). +- **mark_back** (*Optional*, 0-255): Code of the character used to mark menu items going back + one level. As the character set lacks a good looking back arrow, using a user defined character + is advisable (use ``8`` to reference one at position ``0`` to avoid problems with zeros + in a string). Defaults to ``0x5e`` (``^``). +- **mark_selected** (*Optional*, 0-255): Code of the character used to mark menu item selected. + Defaults to ``0x3e`` (``>``). +- **mark_editing** (*Optional*, 0-255): Code of the character used to mark menu item editing mode. + Defaults to ``0x2a`` (``*``). +- **mark_submenu** (*Optional*, 0-255): Code of the character used to mark menu item leading to a + submenu. Defaults to ``0x7e`` (a right arrow). The rest of the configuration is described in the :ref:`Display Menu ` component. The menu inherits the dimensions of the connected LCD display and uses the entire area. diff --git a/components/ezo_pmp.rst b/components/ezo_pmp.rst index d373e7e71..e0755ef75 100644 --- a/components/ezo_pmp.rst +++ b/components/ezo_pmp.rst @@ -8,13 +8,13 @@ Atlas Scientific Peristaltic Pump The ``ezo_pmp`` component allows you to use an Atlas Scientific Peristaltic Pump with ESPHome. Both the EZO-PMP (`datasheet `__) -and EZO-PMP-L (`datasheet `__) are supported. +and EZO-PMP-L (`datasheet `__) are supported. The :ref:`I²C Bus ` is required to be set up in your configuration for this sensor to work. .. note:: This component will not be directly controllable in the Home Assistant front-end automatically because - Home Assistant doesn't have support for pumps. In order to control the pump from the frontend you will need to use + Home Assistant doesn't have support for pumps. In order to control the pump from the frontend you will need to use templates to offer access to the actions you need. Please see :ref:`ezo-pmp-ha-config`. .. figure:: images/ezo-pmp.jpg @@ -35,7 +35,7 @@ Configuration variables: - **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``. -Sensors +Sensors ----------------------------- Since the EZO-PMP offers a large number of sensors and each sensor needs to be polled individually, the code has been @@ -88,7 +88,7 @@ Configuration variables: ``absolute_total_volume_dosed`` ------------------------------- -This sensor indicates the absolute total volume (in milliliters) that has been dosed since the last time the pump was turned on. +This sensor indicates the absolute total volume (in milliliters) that has been dosed since the last time the pump was turned on. .. code-block:: yaml @@ -130,7 +130,7 @@ Configuration variables: ----------------------------- The pump provides its own calculation of the maximum flow rate it can provide (in ml/minute). Dosing requests that exceed this rate -will fail. When using the :ref:`Dose Continuously ` Action, this is the volume the pump will +will fail. When using the :ref:`Dose Continuously ` Action, this is the volume the pump will dose every minute. This value will get updated after the pump is calibrated (see :ref:`ezo_pmp-set_calibration_volume_action`). .. code-block:: yaml @@ -166,7 +166,7 @@ Configuration variables: - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Sensor `. -Binary Sensors +Binary Sensors ----------------------------- .. _ezo_pmp-pump_state_binary_sensor: @@ -174,7 +174,7 @@ Binary Sensors ``pump_state`` ----------------------------- -Indicates if the pump is currently running or not. +Indicates if the pump is currently running or not. .. code-block:: yaml @@ -253,7 +253,7 @@ Configuration variables: - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Text Sensor `. -Actions +Actions ----------------------------- .. _ezo_pmp-dose_continuously_action: @@ -309,8 +309,8 @@ Configuration options: ``ezo_pmp.dose_volume_over_time`` Action ---------------------------------------- -Use this action in an :ref:`automations ` to have the peristaltic pump dose an specific `volume` (in milliliters) -over the provided `duration` (in minutes). At the end of the time period the pump will have dosed the specified `volume`. +Use this action in an :ref:`automations ` to have the peristaltic pump dose an specific ``volume`` (in milliliters) +over the provided ``duration`` (in minutes). At the end of the time period the pump will have dosed the specified ``volume``. If the volume is negative the pump will run backwards. .. code-block:: yaml @@ -319,7 +319,7 @@ If the volume is negative the pump will run backwards. then: - ezo_pmp.dose_volume_over_time: id: ezo_pmp - volume: 23.4 + volume: 23.4 duration: 2 # Templated @@ -342,8 +342,8 @@ Configuration options: ``ezo_pmp.dose_with_constant_flow_rate`` Action ----------------------------------------------- -Use this action in an :ref:`automations ` to have the peristaltic pump dose an specific `volume` (in milliliters) every minute -for the provided `duration` (in minutes). At the end of the time period the pump will have dosed the specified `volume` times the `duration`. +Use this action in an :ref:`automations ` to have the peristaltic pump dose an specific ``volume`` (in milliliters) every minute +for the provided ``duration`` (in minutes). At the end of the time period the pump will have dosed the specified ``volume`` times the ``duration``. If the volume is negative the pump will run backwards. .. code-block:: yaml @@ -496,7 +496,7 @@ Configuration options: ``ezo_pmp.change_i2c_address`` Action ------------------------------------------- -Changes the i2c address of the pump to the provided value. After the address is changed you must upload a new version of the ESPHome firmware with the updated I2C +Changes the i2c address of the pump to the provided value. After the address is changed you must upload a new version of the ESPHome firmware with the updated I2C address for the pump to work. .. code-block:: yaml @@ -517,8 +517,8 @@ Configuration options: Home Assistant Configuration ---------------------------- -In order to provide control of the pump from the home assistant frontend it is important to expose the actions -as components that have UI rendering. This could be done using templates in ESPHome. Here is an example using a +In order to provide control of the pump from the home assistant frontend it is important to expose the actions +as components that have UI rendering. This could be done using templates in ESPHome. Here is an example using a `Template Button` and `Template Number` to dose a certain volume over time. .. code-block:: yaml @@ -561,7 +561,7 @@ lambda calls ------------ From :ref:`lambdas `, you can also access the actions on the peristaltic pump to do some -advanced stuff (see the full API Reference for more info). The name of the functions is the same as the name +advanced stuff (see the full API Reference for more info). The name of the functions is the same as the name of the actions in YAML config. See Also diff --git a/components/sensor/ble_client.rst b/components/sensor/ble_client.rst index db0683786..b579e305e 100644 --- a/components/sensor/ble_client.rst +++ b/components/sensor/ble_client.rst @@ -39,24 +39,24 @@ Configuration variables: - **type** (**Required**): One of ``rssi``, ``characteristic``. - rssi options: +rssi options: - - **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device. - - All other options from :ref:`Sensor `. +- **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device. +- All other options from :ref:`Sensor `. - characteristic options: +characteristic options: - - **ble_client_id** (**Required**, :ref:`config-id`): ID of the associated BLE client. - - **service_uuid** (**Required**, UUID): UUID of the service on the device. - - **characteristic_uuid** (**Required**, UUID): UUID of the service's characteristic to query. - - **descriptor_uuid** (*Optional*, UUID): UUID of the characteristic's descriptor to query. - - **id** (*Optional*, :ref:`config-id`): The ID to use for code generation, and for reference by dependent components. - - **lambda** (*Optional*, :ref:`lambda `): The lambda to use for converting a raw data - reading to a sensor value. See :ref:`ble-sensor-lambda` for more information. - - **notify** (*Optional*, boolean): Instruct the server to send notifications for this - characteristic. - - **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device. - - All other options from :ref:`Sensor `. +- **ble_client_id** (**Required**, :ref:`config-id`): ID of the associated BLE client. +- **service_uuid** (**Required**, UUID): UUID of the service on the device. +- **characteristic_uuid** (**Required**, UUID): UUID of the service's characteristic to query. +- **descriptor_uuid** (*Optional*, UUID): UUID of the characteristic's descriptor to query. +- **id** (*Optional*, :ref:`config-id`): The ID to use for code generation, and for reference by dependent components. +- **lambda** (*Optional*, :ref:`lambda `): The lambda to use for converting a raw data + reading to a sensor value. See :ref:`ble-sensor-lambda` for more information. +- **notify** (*Optional*, boolean): Instruct the server to send notifications for this + characteristic. +- **update_interval** (*Optional*, :ref:`config-time`): The interval to poll the device. +- All other options from :ref:`Sensor `. Automations: diff --git a/components/sensor/ezo.rst b/components/sensor/ezo.rst index 810ef414d..515bb8c96 100644 --- a/components/sensor/ezo.rst +++ b/components/sensor/ezo.rst @@ -45,24 +45,27 @@ Configuration variables: - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Sensor `. -.. _evo_callbacks: +Automation triggers: -Callbacks ---------- +- **on_led** (*Optional*, :ref:`Action `): Triggered when the result of ``get_led_state()`` is ready. The LED + state is provided as a boolean variable named ``x``. +- **on_device_information** (*Optional*, :ref:`Action `): Triggered when the result of ``get_device_information()`` + is ready. The result is provided as a ``std::string`` variable named ``x``. +- **on_slope** (*Optional*, :ref:`Action `): Triggered when the result of ``get_slope()`` is ready. The result + is provided as a ``std::string`` variable named ``x``. +- **on_calibration** (*Optional*, :ref:`Action `): Triggered when the result of ``get_calibration()`` is ready. + The result is provided as a ``std::string`` variable named ``x``. +- **on_t** (*Optional*, :ref:`Action `): Triggered when the result of ``get_t()`` is ready. The result is provided + as a ``std::string`` variable named ``x``. +- **on_custom** (*Optional*, :ref:`Action `): Triggered when the result of ``get_custom()`` is ready. The result is provided as a ``std::string`` variable named ``x``. -- **on_led:** : Triggered when the result of ``get_led_state()`` is ready. The LED state is provided as a boolean variable named ``x``. -- **on_device_information:** : Triggered when the result of ``get_device_information()`` is ready. The result is provided as a ``std::string`` variable named ``x``. -- **on_slope:** : Triggered when the result of ``get_slope()`` is ready. The result is provided as a ``std::string`` variable named ``x``. -- **on_calibration:** : Triggered when the result of ``get_calibration()`` is ready. The result is provided as a ``std::string`` variable named ``x``. -- **on_t:** : Triggered when the result of ``get_t()`` is ready. The result is provided as a ``std::string`` variable named ``x``. -- **on_custom:** : Triggered when the result of ``get_custom()`` is ready. The result is provided as a ``std::string`` variable named ``x``. +.. _ezo_lambda_calls: -.. _evo_lambda_calls: - -lambda calls +Lambda calls ------------ -From :ref:`lambdas `, you can interact with the sensor in various ways. For any ``get`` command a trigger will be called with the information retrieved from the sensor. See :ref:`evo_callbacks`. For more information on the command specifics, refer to the datasheet. +From :ref:`lambdas `, you can interact with the sensor in various ways. For any ``get`` command a trigger will be called +with the information retrieved from the sensor. For more information on the command specifics, refer to the datasheet. - ``set_i2c(uint8_t address)``: Set I2C address of the device, must be an integer between 1 and 127 diff --git a/components/sensor/mpl3115a2.rst b/components/sensor/mpl3115a2.rst index 6c06c22a5..4333ed9c7 100644 --- a/components/sensor/mpl3115a2.rst +++ b/components/sensor/mpl3115a2.rst @@ -35,19 +35,19 @@ Configuration variables: The MPL3115A2 can be configured to output either pressure or altitude depending on which sensor is configured. -- **pressure** (**Optional**): The information for the pressure sensor. +- **pressure** (*Optional*): The information for the pressure sensor. - **name** (**Required**, string): The name for the pressure sensor. - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Sensor `. -- **altitude** (**Optional**): The information for the altitude sensor. +- **altitude** (*Optional*): The information for the altitude sensor. - **name** (**Required**, string): The name for the altitude sensor. - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Sensor `. -- **temperature** (**Optional**): The information for the temperature sensor. +- **temperature** (*Optional*): The information for the temperature sensor. - **name** (**Required**, string): The name for the temperature sensor. - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. diff --git a/components/sensor/ufire_ec.rst b/components/sensor/ufire_ec.rst index ff34fab6e..a037ce19c 100644 --- a/components/sensor/ufire_ec.rst +++ b/components/sensor/ufire_ec.rst @@ -20,7 +20,7 @@ linked to the uFire EC configuration. # Example configuration entry sensor: - - platform: ufire_ec + - platform: ufire_ec id: ufire_ec_board temperature: id: temperature_liquit @@ -32,7 +32,7 @@ linked to the uFire EC configuration. Configuration variables: ------------------------ -- **address** (**Optional**, int): Specify the I²C address of the sensor. Defaults to ``0x3C``. +- **address** (*Optional*, int): Specify the I²C address of the sensor. Defaults to ``0x3C``. - **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``. - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. @@ -47,8 +47,8 @@ Configuration variables: .. _sensor-ufire_ec-calibrate_probe_action: -``sensor.ufire_ec.calibrate_probe`` Action ------------------------------------------- +``ufire_ec.calibrate_probe`` Action +----------------------------------- The EC probe have to be calibrated. For this you need know the EC reference value and temperature of the calibration solution. @@ -76,8 +76,8 @@ Configuration options: .. _sensor-ufire_ec-reset_action: -``sensor.ufire_ec.reset`` Action --------------------------------- +``ufire_ec.reset`` Action +------------------------- Reset the current calibration on the sensor. diff --git a/components/sensor/ufire_ise.rst b/components/sensor/ufire_ise.rst index 0f4bacae6..1b9972ed8 100644 --- a/components/sensor/ufire_ise.rst +++ b/components/sensor/ufire_ise.rst @@ -20,7 +20,7 @@ be on the same board or external sensor linked to the uFire ISE pH configuration # Example configuration entry sensor: - - platform: ufire_ise + - platform: ufire_ise id: ufire_ise_board temperature: id: temperature_liquit @@ -32,7 +32,7 @@ be on the same board or external sensor linked to the uFire ISE pH configuration Configuration variables: ------------------------ -- **address** (**Optional**, int): Specify the I²C address of the sensor. Defaults to ``0x3f``. +- **address** (*Optional*, int): Specify the I²C address of the sensor. Defaults to ``0x3f``. - **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``. - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. @@ -44,8 +44,8 @@ Configuration variables: .. _sensor-ufire_ise-calibrate_probe_high_action: -``sensor.ufire_ise.calibrate_probe_high`` Action ------------------------------------------------- +``ufire_ise.calibrate_probe_high`` Action +----------------------------------------- The pH probe have to be calibrated. For this you need know the pH reference value and temperature of the calibration high solution. @@ -69,12 +69,11 @@ Configuration options: - **id** (**Required**, :ref:`config-id`): The ID of the ufire pH sensor. - **solution** (**Required**, float): Solution reference pH value. -- **temperature** (**Required**, float): Solution current temperature. .. _sensor-ufire_ise-calibrate_probe_low_action: -``sensor.ufire_ise.calibrate_probe_low`` Action ------------------------------------------------ +``ufire_ise.calibrate_probe_low`` Action +---------------------------------------- The pH probe have to be calibrated. For this you need know the pH reference value and temperature of the calibration low solution. @@ -98,12 +97,11 @@ Configuration options: - **id** (**Required**, :ref:`config-id`): The ID of the ufire pH sensor. - **solution** (**Required**, float): Solution reference pH value. -- **temperature** (**Required**, float): Solution current temperature. .. _sensor-ufire_ise-reset_action: -``sensor.ufire_ise.reset`` Action ---------------------------------- +``ufire_ise.reset`` Action +-------------------------- Reset the current calibration on the sensor. diff --git a/components/touchscreen/xpt2046.rst b/components/touchscreen/xpt2046.rst index 12905a56f..d000fa970 100644 --- a/components/touchscreen/xpt2046.rst +++ b/components/touchscreen/xpt2046.rst @@ -56,7 +56,7 @@ Base Configuration: via SPI. This key is renamed from **irq_pin** - **update_interval** (*Optional*, :ref:`config-time`): The interval to check the - sensor. If ``interrupt_pin`` is specified the touch will be detected nearly instantaneously and this setting + sensor. If ``interrupt_pin`` is specified the touch will be detected nearly instantaneously and this setting will be used only for the release detection. Defaults to ``50ms``. - **report_interval** (*Optional*, :ref:`config-time`): The interval to periodically diff --git a/schema_doc.py b/schema_doc.py index 4cce753f7..9dc5869eb 100644 --- a/schema_doc.py +++ b/schema_doc.py @@ -183,6 +183,17 @@ CUSTOM_DOCS = { "components/display/ssd1327": {"_LoadSchema": False}, "components/display/ssd1351": {"_LoadSchema": False}, "components/copy": {"_LoadSchema": False}, + "components/display_menu/index": { + "Display Menu": "display_menu_base.schemas.DISPLAY_MENU_BASE_SCHEMA", + "Select": "display_menu_base.schemas.MENU_TYPES.schema.config_vars.items.types.select", + "Menu": "display_menu_base.schemas.MENU_TYPES.schema.config_vars.items.types.menu", + "Number": "display_menu_base.schemas.MENU_TYPES.schema.config_vars.items.types.number", + "Switch": "display_menu_base.schemas.MENU_TYPES.schema.config_vars.items.types.switch", + "Custom": "display_menu_base.schemas.MENU_TYPES.schema.config_vars.items.types.custom", + }, + "components/display_menu/lcd_menu": { + "LCD Menu": "lcd_menu.schemas.CONFIG_SCHEMA", + }, } @@ -226,6 +237,18 @@ class SchemaGeneratorVisitor(nodes.NodeVisitor): self.json_component = self.file_schema[self.component]["schemas"][ "CONFIG_SCHEMA" ] + elif self.path[1] == "display_menu": # weird folder naming + if self.path[2] == "index": + # weird component name mismatch + self.component = "display_menu_base" + else: + self.component = self.path[2] + + self.file_schema = get_component_file(app, self.component) + self.json_component = self.file_schema[self.component]["schemas"][ + "CONFIG_SCHEMA" + ] + else: # sub component, e.g. output/esp8266_pwm # components here might have a core / hub, eg. dallas, ads1115 @@ -288,9 +311,10 @@ class SchemaGeneratorVisitor(nodes.NodeVisitor): elif componentName in core["platforms"]: core["platforms"][componentName]["docs"] = description else: - raise ValueError( - "Cannot set description for component " + componentName - ) + if componentName != "display_menu_base": + raise ValueError( + "Cannot set description for component " + componentName + ) def visit_document(self, node): # ESPHome page docs follows strict formatting guidelines which allows @@ -1156,8 +1180,8 @@ def handle_component(app, doctree, docname): elif docname not in CUSTOM_DOCS: return - v = SchemaGeneratorVisitor(app, doctree, docname) try: + v = SchemaGeneratorVisitor(app, doctree, docname) doctree.walkabout(v) except Exception as e: err_str = f"In {docname}.rst: {str(e)}"