From 3365e091f44a25afd58778f624331b60a7f2b1f5 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 7 Nov 2017 09:49:28 +0100 Subject: [PATCH] Migration Arduino to new config style (#3919) --- source/_components/arduino.markdown | 9 ++++-- source/_components/sensor.arduino.markdown | 21 ++++++++++---- source/_components/switch.arduino.markdown | 33 +++++++++++++++++----- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/source/_components/arduino.markdown b/source/_components/arduino.markdown index acfd091c727..5105f19c4cc 100644 --- a/source/_components/arduino.markdown +++ b/source/_components/arduino.markdown @@ -30,9 +30,12 @@ arduino: port: /dev/ttyACM0 ``` -Configuration variables: - -- **port** (*Required*): The port where your board is connected to your Home Assistant host. If you are using an original Arduino, the port will be named `ttyACM*` otherwise `ttyUSB*`. +{% configuration %} +port: + description: The port where your board is connected to your Home Assistant host. If you are using an original Arduino, the port will be named `ttyACM*` otherwise `ttyUSB*`. + required: true + type: string +{% endconfiguration %} The exact number can be determined with the command shown below. diff --git a/source/_components/sensor.arduino.markdown b/source/_components/sensor.arduino.markdown index 3989aaf95f1..02fa7f6aaac 100644 --- a/source/_components/sensor.arduino.markdown +++ b/source/_components/sensor.arduino.markdown @@ -27,14 +27,23 @@ sensor: name: Door switch 0: name: Brightness - ``` -Configuration variables: - -- **pins** array (*Required*): Array of pins to use. - - **[number]** (*Required*): The pin number that corresponds with the pin numbering schema of your board. - - **name** (*Optional*): Name that will be used in the frontend for the pin. +{% configuration %} +pins: + description: List of pins to use. + required: true + type: map + keys: + pin_number: + description: The pin number that corresponds with the pin numbering schema of your board. + required: true + type: map + keys: + name: + default: Name that will be used in the frontend for the pin. + type: string +{% endconfiguration %} The 6 analog pins of an Arduino UNO are numbered from A0 to A5. diff --git a/source/_components/switch.arduino.markdown b/source/_components/switch.arduino.markdown index 6b15a63431b..bc4f76b19e3 100644 --- a/source/_components/switch.arduino.markdown +++ b/source/_components/switch.arduino.markdown @@ -31,13 +31,32 @@ switch: negate: true ``` -Configuration variables: - -- **pins** array (*Required*): List of pins to use. - - **[number]** (*Required*): The pin number that corresponds with the pin numbering schema of your board. - - **name** (*Required*): Name that will be used in the frontend for the pin. - - **initial** (*Optional*): The initial value for this port. Defaults to `False` . - - **negate** (*Optional*): If this pin should be inverted. Defaults to `False`. +{% configuration %} +pins: + description: List of of pins to use. + required: true + type: map + keys: + pin_number: + description: The pin number that corresponds with the pin numbering schema of your board. + required: true + type: map + keys: + name: + default: Name that will be used in the frontend for the pin. + type: string + required: false + initial: + default: The initial value for this port. + type: boolean + required: false + default: false + negate: + default: If this pin should be inverted. + type: boolean + required: false + default: false +{% endconfiguration %} The digital pins are numbered from 0 to 13 on a Arduino UNO. The available pins are 2 till 13. For testing purposes you can use pin 13 because with that pin you can control the internal LED.