-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New 1-wire Component: Dallas PIO (DS2413 DS2406 DS2408) #4584
base: current
Are you sure you want to change the base?
Changes from 34 commits
95ec858
a3b39cb
cf86363
d29083a
1924f45
c8dd12d
e7e3e97
2711a57
df1b790
7aee325
b3d5296
e7512c4
1aec40f
3d08784
1f7d3d6
d473f2e
a553e3a
1864c95
3fe3f8e
4657b35
bc018be
f0394b1
71b756c
d49b570
65eea7d
1044a1c
a31c85d
481ed82
3bae876
ac57f04
6531b6d
f171f56
4b99432
0e68c0c
f9c1c67
7dad1d8
a86b151
23a4f88
9783241
ca999bd
eb1aae0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
Dallas PIO Binary Sensor | ||
======================== | ||
|
||
.. seo:: | ||
:description: Instructions for setting up Dallas 1-Wire PIO addressable switch as ESPHome binary sensor | ||
:image: dallas_pio.jpg | ||
:keywords: Dallas, ds2413, ds2406, ds2408, onewire | ||
|
||
The ``dallas_pio`` component allows you to use | ||
`DS2413 <https://www.adafruit.com/product/1551>`__ | ||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2413.pdf>`__), | ||
`DS2406` | ||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2406.pdf>`__), | ||
`DS2408` | ||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2408.pdf>`__) | ||
and similar 1-Wire Dallas addressable switches PIO as ESPHome binary sensors. A :ref:`Dallas PIO <dallas_pio>` is | ||
required to be set up in your configuration for this binary sensor to work. | ||
|
||
Example Configuration | ||
********************* | ||
|
||
Below are configuration examples for different Dallas devices, including DS2408 with P0-P7 pin usage. | ||
|
||
**Single DS2413 on One-Wire Bus** | ||
|
||
.. code-block:: yaml | ||
|
||
# Example configuration entry | ||
binary_sensor: | ||
- platform: dallas_pio | ||
name: ds2413 binary sensor # Friendly name for the binary sensor | ||
dallas_pio_id: ds2413_ic1 # Reference to the Dallas PIO component | ||
id: ds2413_binary_sensor # Optional ID for internal reference | ||
pin: | ||
number: PIOA # Pin to use on the Dallas device (PIOA/PIOB for DS2413/DS2406, P0-P7 for DS2408) | ||
mode: # Configuration of the pin's behavior | ||
input: true # If set, must be true to read input values from the pin | ||
inverted: true # Invert the signal (true = active-low, false = active-high) | ||
update_interval: 1s # How often the sensor should poll the pin's state | ||
|
||
**Multiple Devices (DS2413 and DS2408) on the Same Bus** | ||
|
||
.. code-block:: yaml | ||
|
||
# Example configuration entry | ||
binary_sensor: | ||
- platform: dallas_pio | ||
name: ds2413 binary sensor | ||
dallas_pio_id: ds2413_ic1 | ||
id: ds2413_binary_sensor | ||
pin: | ||
number: PIOA | ||
mode: | ||
input: true | ||
inverted: true | ||
update_interval: 1s | ||
|
||
- platform: dallas_pio | ||
name: ds2408 binary sensor | ||
dallas_pio_id: ds2408_ic2 | ||
id: ds2408_binary_sensor | ||
pin: | ||
number: P0 | ||
mode: | ||
input: true | ||
inverted: true | ||
update_interval: 1s | ||
|
||
|
||
Configuration variables: | ||
************************ | ||
|
||
- **name** (*Optional*, string): The name for the sensor. At least one of **id** and **name** must be specified. | ||
- **id** (*Optional*, string): Manually specify the ID for code generation. At least one of **id** and **name** must be specified. | ||
- **dallas_pio_id** (*Required*, string): The ID of the dallas pio to use. | ||
- **pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The PIO pin to use for the binary sensor. | ||
|
||
Options: | ||
- **number**: The pin to use. For DS2413 or DS2406, use `PIOA` or `PIOB`. For DS2408, use `P0` to `P7`. | ||
- **mode**: | ||
- `input: true`: Configure the pin as an input (default) | ||
- `input: false`: not allowed (binary sensor acts necessarily as an input). | ||
- **inverted**: Set to `true` to interpret a high signal as low (active-low). Useful for devices where a low voltage signifies an active state. Defaults to `false`. | ||
|
||
- **update_interval** (*Optional*, :ref:`config-time`): The interval that the binary sensors should be checked. Defaults to 1 second. | ||
- All other options from :ref:`Binary Sensor <config-binary_sensor>`. | ||
|
||
See Also | ||
-------- | ||
|
||
- :apiref:`dallas_pio/binary_sensor.h` | ||
- :ghedit:`Edit` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.. _dallas_pio: | ||
|
||
Dallas PIO | ||
========== | ||
|
||
.. seo:: | ||
:description: Instructions for setting up Dallas 1-Wire addressable switches | ||
:image: dallas_pio.jpg | ||
:keywords: Dallas, PIO, DS2413, DS2406, DS2408, onewire, 1-wire | ||
|
||
The ``dallas_pio`` component allows you to use | ||
`DS2413 <https://www.adafruit.com/product/1551>`__ | ||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2413.pdf>`__), | ||
`DS2406` | ||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2406.pdf>`__), | ||
`DS2408` | ||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2408.pdf>`__) | ||
and similar 1-Wire addressable switches. A :ref:`1-Wire bus <one_wire>` is | ||
required to be set up in your configuration for this sensor to work. | ||
|
||
Example Configuration | ||
********************* | ||
|
||
Below are configuration examples for different Dallas devices. | ||
|
||
**Single DS2413 on One-Wire Bus** | ||
|
||
.. code-block:: yaml | ||
|
||
# Example configuration entry | ||
dallas_pio: | ||
- id: ds2413_ic1 | ||
name: DS2413 IC1 | ||
reference: DS2413 | ||
address: 0xfe10055073e122ba | ||
one_wire_id: OneWireBus1 | ||
|
||
**Multiple Devices (DS2413 and DS2408) on the Same Bus** | ||
|
||
.. code-block:: yaml | ||
|
||
# Example configuration entry | ||
dallas_pio: | ||
- id: ds2413_ic1 | ||
name: DS2413 IC1 | ||
reference: DS2413 | ||
address: 0xfe10055073e122ba | ||
one_wire_id: OneWireBus1 | ||
|
||
- id: ds2408_ic2 | ||
name: DS2408 IC2 | ||
reference: DS2408 | ||
address: 0x1234567812345628 | ||
one_wire_id: OneWireBus1 | ||
|
||
**Address Format** | ||
|
||
The `address` parameter specifies the unique 1-Wire address of the device. This address is an 8-byte hexadecimal value (e.g., `0xfe10055073e122ba`) and can typically be obtained using a 1-Wire bus scanner or through the Dallas 1-Wire library. | ||
|
||
|
||
Configuration variables: | ||
************************ | ||
- **id** (*Optional*, string): Manually specify the ID for code generation. At least one of **id** and **name** must be specified. | ||
- **name** (*Optional*, string): The name for the sensor. At least one of **id** and **name** must be specified. | ||
- **reference** (*Optional*, string): The dallas reference of adressable switch among DS2413 (default), DS2406 or DS2408 (see warning note below). | ||
- **address** (*Required*, int): The address of the sensor. Required if there is more than one device on the bus. | ||
- **crc** (*Optional*, bool): [DS2406 only] Use CRC if true. Defaults to false. | ||
- **one_wire_id** (*Required*, :ref:`config-id`): Manually specify the ID used for code generation. Required if you have multiple busses. | ||
|
||
Comment on lines
+61
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix typo and clarify CRC usage.
|
||
|
||
See Also | ||
-------- | ||
|
||
- :doc:`/components/binary_sensor/index` | ||
- :doc:`/components/switch/index` | ||
- :doc:`/components/one_wire` | ||
- :apiref:`dallas_pio/dallas_pio.h` | ||
- :ghedit:`Edit` |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,96 @@ | ||||||||||||||||||||||||||||||
Dallas PIO Switch | ||||||||||||||||||||||||||||||
================= | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
.. seo:: | ||||||||||||||||||||||||||||||
:description: Instructions for setting up Dallas 1-Wire PIO addressable switch as ESPHome switch | ||||||||||||||||||||||||||||||
:image: dallas_pio.jpg | ||||||||||||||||||||||||||||||
:keywords: Dallas, ds2413, ds2406, ds2408, onewire | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
The ``dallas_pio`` component allows you to use | ||||||||||||||||||||||||||||||
`DS2413 <https://www.adafruit.com/product/1551>`__ | ||||||||||||||||||||||||||||||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2413.pdf>`__), | ||||||||||||||||||||||||||||||
`DS2406` | ||||||||||||||||||||||||||||||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2406.pdf>`__), | ||||||||||||||||||||||||||||||
`DS2408` | ||||||||||||||||||||||||||||||
(`datasheet <https://datasheets.maximintegrated.com/en/ds/DS2408.pdf>`__) | ||||||||||||||||||||||||||||||
and similar 1-Wire Dallas addressable switches PIO as ESPHome switch. A :ref:`Dallas PIO <dallas_pio>` is | ||||||||||||||||||||||||||||||
required to be set up in your configuration for this binary sensor to work. | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect component reference. The text incorrectly refers to a "binary sensor" when this is a switch component documentation. -required to be set up in your configuration for this binary sensor to work.
+required to be set up in your configuration for this switch to work. 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
.. warning:: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
**DS2408**: don't forget to put a pull up resistor to Vcc on the RSTZ pin to enable writing to ports P0 to P7 ! | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Example Configuration | ||||||||||||||||||||||||||||||
********************* | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Below are configuration examples for different Dallas devices, including DS2408 with P0-P7 pin usage. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
**Single DS2413 on One-Wire Bus** | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
.. code-block:: yaml | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# Example configuration entry | ||||||||||||||||||||||||||||||
switch: | ||||||||||||||||||||||||||||||
- platform: dallas_pio | ||||||||||||||||||||||||||||||
name: ds2413 switch # Friendly name for the switch | ||||||||||||||||||||||||||||||
dallas_pio_id: ds2413_ic1 # Reference to the Dallas PIO component | ||||||||||||||||||||||||||||||
id: ds2413_switch # Optional ID for internal reference | ||||||||||||||||||||||||||||||
pin: | ||||||||||||||||||||||||||||||
number: PIOB # Pin to use on the Dallas device (PIOA/PIOB for DS2413/DS2406, P0-P7 for DS2408) | ||||||||||||||||||||||||||||||
mode: # Configuration of the pin's behavior | ||||||||||||||||||||||||||||||
output: true # If set, must be true to output values to the pin | ||||||||||||||||||||||||||||||
inverted: true # Invert the signal (true = active-low, false = active-high) | ||||||||||||||||||||||||||||||
inverted: false # Invert the switch | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
**Multiple Devices (DS2413 and DS2408) on the Same Bus** | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
.. code-block:: yaml | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# Example configuration entry | ||||||||||||||||||||||||||||||
switch: | ||||||||||||||||||||||||||||||
- platform: dallas_pio | ||||||||||||||||||||||||||||||
name: ds2413 switch | ||||||||||||||||||||||||||||||
dallas_pio_id: ds2413_ic1 | ||||||||||||||||||||||||||||||
id: ds2413_switch | ||||||||||||||||||||||||||||||
pin: | ||||||||||||||||||||||||||||||
number: PIOB | ||||||||||||||||||||||||||||||
mode: | ||||||||||||||||||||||||||||||
output: true | ||||||||||||||||||||||||||||||
inverted: true | ||||||||||||||||||||||||||||||
Comment on lines
+55
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Document pin mode options The pin configuration example shows mode options, but these are not documented in the configuration variables section. Please add documentation for the available pin modes. Add the following to the configuration variables section: - **pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The PIO pin to use for the switch.
+ **pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The PIO pin to use for the switch.
+ - **mode** (*Optional*): Configure the pin mode.
+ - **output** (*Optional*, bool): Set to true to configure the pin as output (default: false). 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
inverted: false | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
- platform: dallas_pio | ||||||||||||||||||||||||||||||
name: ds2408 switch | ||||||||||||||||||||||||||||||
dallas_pio_id: ds2408_ic2 | ||||||||||||||||||||||||||||||
id: ds2408_switch | ||||||||||||||||||||||||||||||
pin: | ||||||||||||||||||||||||||||||
number: P0 | ||||||||||||||||||||||||||||||
mode: | ||||||||||||||||||||||||||||||
output: true | ||||||||||||||||||||||||||||||
inverted: true | ||||||||||||||||||||||||||||||
inverted: false | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Configuration variables: | ||||||||||||||||||||||||||||||
************************ | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
- **name** (*Optional*, string): The name for the sensor. At least one of **id** and **name** must be specified. | ||||||||||||||||||||||||||||||
- **id** (*Optional*, string): Manually specify the ID for code generation. At least one of **id** and **name** must be specified. | ||||||||||||||||||||||||||||||
- **dallas_pio_id** (*Required*, string): The ID of the dallas pio to use. | ||||||||||||||||||||||||||||||
- **pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The PIO pin to use for the switch. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Options: | ||||||||||||||||||||||||||||||
- **number**: The pin to use. For DS2413 or DS2406, use `PIOA` or `PIOB`. For DS2408, use `P0` to `P7`. | ||||||||||||||||||||||||||||||
- **mode**: | ||||||||||||||||||||||||||||||
- `output: true`: Configure the pin as an output (default) | ||||||||||||||||||||||||||||||
- `output: false`: not allowed (switch acts necessarily as an output). | ||||||||||||||||||||||||||||||
- **inverted**: Set to `true` to interpret a high signal as low (active-low). Useful for devices where a low voltage signifies an active state. Defaults to `false`. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
- **inverted** (*Optional*, bool): Switch inverted if true (default: false). | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove redundant inverted option. The -- **inverted** (*Optional*, bool): Switch inverted if true (default: false). |
||||||||||||||||||||||||||||||
- All other options from :ref:`Switch <config-switch>`. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
See Also | ||||||||||||||||||||||||||||||
-------- | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
- :apiref:`dallas_pio/switch.h` | ||||||||||||||||||||||||||||||
- :ghedit:`Edit` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing image file.
The pipeline is failing because the referenced image file 'dallas_pio.jpg' is missing. Please add the image to the
/images
directory.🧰 Tools
🪛 GitHub Actions: Lint
[error] Missing image file: The referenced image file '/home/runner/work/esphome-docs/esphome-docs/images/dallas_pio.jpg' does not exist but is required for the SEO tag