From bfe3f8c3ed32fc42b19680e25288816e4dfc0674 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:17:42 +0300 Subject: [PATCH 01/16] Create storage.md --- content/components/storage.md | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 content/components/storage.md diff --git a/content/components/storage.md b/content/components/storage.md new file mode 100644 index 0000000000..4adb8362bc --- /dev/null +++ b/content/components/storage.md @@ -0,0 +1,87 @@ +--- +description: "Interface for storage devices." +title: "Storage" +params: + seo: + description: Information about base storage device interface. + image: fatfs.svg +--- + +Storage is the API for different kind of devise for save and retrive datas. +It can be used for read and write data blocks, but primary target is to use as device driver +for filesystems library. + +{{< anchor "storage-base-config" >}} + +## Base fatfs Configuration + +Each FATFS device represented by the platform component with coresponding type. Each platform type inherits parameters from fatfs configuration schema. + +```yaml + +storage: + - platform: ... + ... + - platform: ... + ... + +``` + +**Configuration variables:** + +- **platform** (**Required**, [platform](#platforms-storage)): One of the supported storage [Platforms](#platforms-storage). +- **id** (*Optional*, [ID](#config-id)): Manually specify the ID used for code generation. +- **cd_pin** (*Optional*, [Pin Schema](#config-pin_schema)): The pin used for storage media detect in case it is a removable media like sdcard. CD pin used in some card holders. + +{{< anchor "storage-is_pressent-condition" >}} + +## Exist Condition + +This is an condition for checking if file or directory by are present. File pointed by its path path. + +```yaml + + - if: + condition: + - storage.is_present: storage_1 + then: + ... + +``` + +Configuration variables: + +- **id** (**Required**, [ID](#config-id)): The ID of storage component + +{{< anchor "storage-lambda-calls" >}} + +### lambda calls + +From [lambdas](#config-lambda), you can call several methods on all storage objects to do some +advanced stuff. + +- Attributes: All storage devices have forlowing attributes + +```cpp + // Initialize device + id(my_fatfs).initialize() + // Read sectors + id(my_fatfs).read_sectors(path) + // wriet sectors + id(my_fatfs).write_sectors(buff*, bloack, count) + // Reset initialization status + id(my_fatfs).reset(path,mode) + // Return true if media present + id(my_fatfs).state_media() + // Id drives iitialized + id(my_fatfs).state_init() + // return error of last operation + id(my_fatfs).error(path) + +``` + +## See Also + +- {{< apiref "Component" "esphome/core/component.h" >}} +- {{< apiref "api" "content/components/api.md">}} +- {{< apiref "storage" "esphome/components/storage/storage.h">}} From 1eea5681ed862265c8c2c2392d1bb6ebb0f041e9 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:19:13 +0300 Subject: [PATCH 02/16] Create storage.md --- content/components/storage/storage.md | 87 +++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 content/components/storage/storage.md diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md new file mode 100644 index 0000000000..4adb8362bc --- /dev/null +++ b/content/components/storage/storage.md @@ -0,0 +1,87 @@ +--- +description: "Interface for storage devices." +title: "Storage" +params: + seo: + description: Information about base storage device interface. + image: fatfs.svg +--- + +Storage is the API for different kind of devise for save and retrive datas. +It can be used for read and write data blocks, but primary target is to use as device driver +for filesystems library. + +{{< anchor "storage-base-config" >}} + +## Base fatfs Configuration + +Each FATFS device represented by the platform component with coresponding type. Each platform type inherits parameters from fatfs configuration schema. + +```yaml + +storage: + - platform: ... + ... + - platform: ... + ... + +``` + +**Configuration variables:** + +- **platform** (**Required**, [platform](#platforms-storage)): One of the supported storage [Platforms](#platforms-storage). +- **id** (*Optional*, [ID](#config-id)): Manually specify the ID used for code generation. +- **cd_pin** (*Optional*, [Pin Schema](#config-pin_schema)): The pin used for storage media detect in case it is a removable media like sdcard. CD pin used in some card holders. + +{{< anchor "storage-is_pressent-condition" >}} + +## Exist Condition + +This is an condition for checking if file or directory by are present. File pointed by its path path. + +```yaml + + - if: + condition: + - storage.is_present: storage_1 + then: + ... + +``` + +Configuration variables: + +- **id** (**Required**, [ID](#config-id)): The ID of storage component + +{{< anchor "storage-lambda-calls" >}} + +### lambda calls + +From [lambdas](#config-lambda), you can call several methods on all storage objects to do some +advanced stuff. + +- Attributes: All storage devices have forlowing attributes + +```cpp + // Initialize device + id(my_fatfs).initialize() + // Read sectors + id(my_fatfs).read_sectors(path) + // wriet sectors + id(my_fatfs).write_sectors(buff*, bloack, count) + // Reset initialization status + id(my_fatfs).reset(path,mode) + // Return true if media present + id(my_fatfs).state_media() + // Id drives iitialized + id(my_fatfs).state_init() + // return error of last operation + id(my_fatfs).error(path) + +``` + +## See Also + +- {{< apiref "Component" "esphome/core/component.h" >}} +- {{< apiref "api" "content/components/api.md">}} +- {{< apiref "storage" "esphome/components/storage/storage.h">}} From 7ef054027b7d64a5d788b6b744ab7c63da54d036 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:19:51 +0300 Subject: [PATCH 03/16] Delete content/components/storage.md --- content/components/storage.md | 87 ----------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 content/components/storage.md diff --git a/content/components/storage.md b/content/components/storage.md deleted file mode 100644 index 4adb8362bc..0000000000 --- a/content/components/storage.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -description: "Interface for storage devices." -title: "Storage" -params: - seo: - description: Information about base storage device interface. - image: fatfs.svg ---- - -Storage is the API for different kind of devise for save and retrive datas. -It can be used for read and write data blocks, but primary target is to use as device driver -for filesystems library. - -{{< anchor "storage-base-config" >}} - -## Base fatfs Configuration - -Each FATFS device represented by the platform component with coresponding type. Each platform type inherits parameters from fatfs configuration schema. - -```yaml - -storage: - - platform: ... - ... - - platform: ... - ... - -``` - -**Configuration variables:** - -- **platform** (**Required**, [platform](#platforms-storage)): One of the supported storage [Platforms](#platforms-storage). -- **id** (*Optional*, [ID](#config-id)): Manually specify the ID used for code generation. -- **cd_pin** (*Optional*, [Pin Schema](#config-pin_schema)): The pin used for storage media detect in case it is a removable media like sdcard. CD pin used in some card holders. - -{{< anchor "storage-is_pressent-condition" >}} - -## Exist Condition - -This is an condition for checking if file or directory by are present. File pointed by its path path. - -```yaml - - - if: - condition: - - storage.is_present: storage_1 - then: - ... - -``` - -Configuration variables: - -- **id** (**Required**, [ID](#config-id)): The ID of storage component - -{{< anchor "storage-lambda-calls" >}} - -### lambda calls - -From [lambdas](#config-lambda), you can call several methods on all storage objects to do some -advanced stuff. - -- Attributes: All storage devices have forlowing attributes - -```cpp - // Initialize device - id(my_fatfs).initialize() - // Read sectors - id(my_fatfs).read_sectors(path) - // wriet sectors - id(my_fatfs).write_sectors(buff*, bloack, count) - // Reset initialization status - id(my_fatfs).reset(path,mode) - // Return true if media present - id(my_fatfs).state_media() - // Id drives iitialized - id(my_fatfs).state_init() - // return error of last operation - id(my_fatfs).error(path) - -``` - -## See Also - -- {{< apiref "Component" "esphome/core/component.h" >}} -- {{< apiref "api" "content/components/api.md">}} -- {{< apiref "storage" "esphome/components/storage/storage.h">}} From aeefd07cdf08714d9fe38e74339dd1fb936344ba Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:21:22 +0300 Subject: [PATCH 04/16] Update storage.md --- content/components/storage/storage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 4adb8362bc..bc0bb43dd9 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -13,9 +13,9 @@ for filesystems library. {{< anchor "storage-base-config" >}} -## Base fatfs Configuration +## Base Stroage Configuration -Each FATFS device represented by the platform component with coresponding type. Each platform type inherits parameters from fatfs configuration schema. +Each Storage device represented by the platform component with coresponding type. Each platform type inherits parameters from storage configuration schema. ```yaml From cb8ce95643b9bda6452e30e575b69117a558ae63 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:27:35 +0300 Subject: [PATCH 05/16] Update storage.md --- content/components/storage/storage.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index bc0bb43dd9..e61c15f321 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -7,9 +7,7 @@ params: image: fatfs.svg --- -Storage is the API for different kind of devise for save and retrive datas. -It can be used for read and write data blocks, but primary target is to use as device driver -for filesystems library. +Storage is the API for different kind of devise for save and retrive datas. It can be used for read and write data blocks, but primary target is to use as device driver for filesystems library. {{< anchor "storage-base-config" >}} From 9b8a7d657602822e0a1619ab7cc31ef1d460b878 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:29:01 +0300 Subject: [PATCH 06/16] Update storage.md --- content/components/storage/storage.md | 40 +++++++++++++-------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index e61c15f321..89f1a757b4 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -38,13 +38,11 @@ storage: This is an condition for checking if file or directory by are present. File pointed by its path path. ```yaml - - - if: - condition: - - storage.is_present: storage_1 - then: - ... - +- if: + condition: + - storage.is_present: storage_1 + then: + ... ``` Configuration variables: @@ -61,20 +59,20 @@ advanced stuff. - Attributes: All storage devices have forlowing attributes ```cpp - // Initialize device - id(my_fatfs).initialize() - // Read sectors - id(my_fatfs).read_sectors(path) - // wriet sectors - id(my_fatfs).write_sectors(buff*, bloack, count) - // Reset initialization status - id(my_fatfs).reset(path,mode) - // Return true if media present - id(my_fatfs).state_media() - // Id drives iitialized - id(my_fatfs).state_init() - // return error of last operation - id(my_fatfs).error(path) + // Initialize device + id(my_fatfs).initialize() + // Read sectors + id(my_fatfs).read_sectors(path) + // wriet sectors + id(my_fatfs).write_sectors(buff*, bloack, count) + // Reset initialization status + id(my_fatfs).reset(path,mode) + // Return true if media present + id(my_fatfs).state_media() + // Id drives iitialized + id(my_fatfs).state_init() + // return error of last operation + id(my_fatfs).error(path) ``` From 7becf52c00a9d6cfb4ad194660ec381cd1efefce Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:31:16 +0300 Subject: [PATCH 07/16] Update storage.md --- content/components/storage/storage.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 89f1a757b4..0f38a75914 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -55,9 +55,7 @@ Configuration variables: From [lambdas](#config-lambda), you can call several methods on all storage objects to do some advanced stuff. - -- Attributes: All storage devices have forlowing attributes - +Attributes: All storage devices have forlowing attributes ```cpp // Initialize device id(my_fatfs).initialize() From de54abb1a26053ad46229d1981170308677b2036 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:32:40 +0300 Subject: [PATCH 08/16] Update storage.md --- content/components/storage/storage.md | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 0f38a75914..878984cd4f 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -55,23 +55,23 @@ Configuration variables: From [lambdas](#config-lambda), you can call several methods on all storage objects to do some advanced stuff. -Attributes: All storage devices have forlowing attributes -```cpp - // Initialize device - id(my_fatfs).initialize() - // Read sectors - id(my_fatfs).read_sectors(path) - // wriet sectors - id(my_fatfs).write_sectors(buff*, bloack, count) - // Reset initialization status - id(my_fatfs).reset(path,mode) - // Return true if media present - id(my_fatfs).state_media() - // Id drives iitialized - id(my_fatfs).state_init() - // return error of last operation - id(my_fatfs).error(path) +- Attributes: All storage devices have forlowing attributes +```cpp +// Initialize device +id(my_fatfs).initialize() +// Read sectors +id(my_fatfs).read_sectors(path) +// wriet sectors +id(my_fatfs).write_sectors(buff*, bloack, count) +// Reset initialization status +id(my_fatfs).reset(path,mode) +// Return true if media present +id(my_fatfs).state_media() +// Id drives iitialized +id(my_fatfs).state_init() +// return error of last operation +id(my_fatfs).error(path) ``` ## See Also From a70b73bc71e7ec3c2621e51b4be783dea652de39 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:36:17 +0300 Subject: [PATCH 09/16] Update storage.md --- content/components/storage/storage.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 878984cd4f..0d43c6866c 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -55,7 +55,9 @@ Configuration variables: From [lambdas](#config-lambda), you can call several methods on all storage objects to do some advanced stuff. -- Attributes: All storage devices have forlowing attributes + +- Attributes: All storage devices have forlowing attributes + ```cpp // Initialize device From 088e32e41b22969864a9310583d5b92b270ed554 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:37:49 +0300 Subject: [PATCH 10/16] Update storage.md --- content/components/storage/storage.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 0d43c6866c..7e6db75131 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -58,7 +58,6 @@ advanced stuff. - Attributes: All storage devices have forlowing attributes - ```cpp // Initialize device id(my_fatfs).initialize() From d84937e7d3273250db860db8ae360756eb48d897 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:44:59 +0300 Subject: [PATCH 11/16] Add files via upload --- content/components/images/storage.svg | 1 + 1 file changed, 1 insertion(+) create mode 100644 content/components/images/storage.svg diff --git a/content/components/images/storage.svg b/content/components/images/storage.svg new file mode 100644 index 0000000000..c0fd9f8cea --- /dev/null +++ b/content/components/images/storage.svg @@ -0,0 +1 @@ + \ No newline at end of file From d5005befaff928d64f69290829cc954c5ae5d5c1 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:46:02 +0300 Subject: [PATCH 12/16] Add image --- content/components/storage/storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 7e6db75131..5549e21738 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -4,7 +4,7 @@ title: "Storage" params: seo: description: Information about base storage device interface. - image: fatfs.svg + image: storage.svg --- Storage is the API for different kind of devise for save and retrive datas. It can be used for read and write data blocks, but primary target is to use as device driver for filesystems library. From 3f2c67695954b5676b0698796e5f63b262905d37 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Mon, 20 Oct 2025 01:53:18 +0300 Subject: [PATCH 13/16] Update storage.md --- content/components/storage/storage.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 5549e21738..e0796b2359 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -27,7 +27,6 @@ storage: **Configuration variables:** -- **platform** (**Required**, [platform](#platforms-storage)): One of the supported storage [Platforms](#platforms-storage). - **id** (*Optional*, [ID](#config-id)): Manually specify the ID used for code generation. - **cd_pin** (*Optional*, [Pin Schema](#config-pin_schema)): The pin used for storage media detect in case it is a removable media like sdcard. CD pin used in some card holders. From 24375c1b288efa4f8fdcf4e7d88e3b4adea885cd Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Tue, 21 Oct 2025 02:48:27 +0300 Subject: [PATCH 14/16] Update storage.md --- content/components/storage/storage.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index e0796b2359..a6710302e7 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -28,13 +28,12 @@ storage: **Configuration variables:** - **id** (*Optional*, [ID](#config-id)): Manually specify the ID used for code generation. -- **cd_pin** (*Optional*, [Pin Schema](#config-pin_schema)): The pin used for storage media detect in case it is a removable media like sdcard. CD pin used in some card holders. {{< anchor "storage-is_pressent-condition" >}} ## Exist Condition -This is an condition for checking if file or directory by are present. File pointed by its path path. +This is an condition for checking if media present. ```yaml - if: From 6cc68b6ea5bd84bc3d6690b036c1bb70203e9599 Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Tue, 21 Oct 2025 02:48:53 +0300 Subject: [PATCH 15/16] Update storage.md --- content/components/storage/storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index a6710302e7..0e52d4836a 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -31,7 +31,7 @@ storage: {{< anchor "storage-is_pressent-condition" >}} -## Exist Condition +## Present Condition This is an condition for checking if media present. From 1c33f347143447ffe63697d78cfafd36f0394a4f Mon Sep 17 00:00:00 2001 From: Belyaev Artem Date: Tue, 21 Oct 2025 02:49:28 +0300 Subject: [PATCH 16/16] Update storage.md --- content/components/storage/storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/components/storage/storage.md b/content/components/storage/storage.md index 0e52d4836a..18e1a43ae0 100644 --- a/content/components/storage/storage.md +++ b/content/components/storage/storage.md @@ -31,7 +31,7 @@ storage: {{< anchor "storage-is_pressent-condition" >}} -## Present Condition +## Is_present Condition This is an condition for checking if media present.