mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-03-10 13:09:37 +01:00
Update Generic Sonoff page
This commit is contained in:
parent
433cefc3ef
commit
a70f7bdff0
@ -106,8 +106,8 @@ complete configuration for a Sonoff B1 looks like:
|
|||||||
password: <YOUR_OTA_PASSWORD>
|
password: <YOUR_OTA_PASSWORD>
|
||||||
|
|
||||||
my9231:
|
my9231:
|
||||||
data_pin: GPIO12
|
data_pin: GPIO12 # GPIO13 for AiLight
|
||||||
clock_pin: GPIO14
|
clock_pin: GPIO14 # GPIO15 for AiLight
|
||||||
num_channels: 6
|
num_channels: 6
|
||||||
num_chips: 2
|
num_chips: 2
|
||||||
|
|
||||||
|
@ -28,287 +28,263 @@ https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/sonoff_templat
|
|||||||
Sonoff RF
|
Sonoff RF
|
||||||
---------
|
---------
|
||||||
|
|
||||||
.. table::
|
.. pintable::
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
GPIO0, Button (inverted),
|
||||||
``GPIO0`` Button (inverted)
|
GPIO12, Relay and Red LED,
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO13, Green LED (inverted),
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
GPIO1, UART RX pin (for external sensors)
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO3, UART TX pin (for external sensors)
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
GPIO4, Optional sensor
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO14, Optional sensor
|
||||||
``GPIO4`` Optional Sensor
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay and Red LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Green LED (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` Optional Sensor
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Sonoff SV
|
Sonoff SV
|
||||||
---------
|
---------
|
||||||
|
|
||||||
.. table::
|
.. pintable::
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
GPIO0, Button (inverted),
|
||||||
``GPIO0`` Button (inverted)
|
GPIO12, Relay and Red LED,
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO13, Green LED (inverted),
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
GPIO17, Analog Input,
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO1, UART RX pin (for external sensors)
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
GPIO3, UART TX pin (for external sensors)
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO4, Optional sensor
|
||||||
``GPIO4`` Optional Sensor
|
GPIO5, Optional sensor
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO14, Optional sensor
|
||||||
``GPIO5`` Optional Sensor
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay and Red LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Green LED (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` Optional Sensor
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO17`` Analog Input
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Sonoff TH
|
Sonoff TH10/TH16
|
||||||
---------
|
----------------
|
||||||
|
|
||||||
.. table::
|
.. pintable::
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
GPIO0, Button (inverted),
|
||||||
``GPIO0`` Button (inverted)
|
GPIO12, Relay and Red LED,
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO13, Green LED (inverted),
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
GPIO1, UART RX pin (for external sensors)
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO3, UART TX pin (for external sensors)
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
GPIO4, Optional sensor
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO14, Optional sensor
|
||||||
``GPIO4`` Optional Sensor
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay and Red LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Green LED (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` Optional Sensor
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
Sonoff Dual R1
|
||||||
|
--------------
|
||||||
|
|
||||||
Slampher
|
.. pintable::
|
||||||
--------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Button (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay and Red LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue LED (inverted)
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Sonoff Touch
|
|
||||||
------------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Button (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay and Red LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue LED (inverted)
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Sonoff LED
|
|
||||||
----------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Button (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO4`` Green Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO5`` Red Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Cold White Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue LED (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` Warm White Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO15`` Blue Channel
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Sonoff T1, Sonoff T2, Sonoff T3
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Button #1 (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO2`` Optional Sensor
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO4`` Relay #3 and Blue LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO5`` Relay #2 and Blue LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO9`` Button #2 (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO10`` Button #3 (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay #1 and Blue LED
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue LED (inverted)
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Arilux LC01
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Optional Button
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO2`` RF receiver (unsupported yet)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO5`` Red Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Green Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` White Channel
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Arilux LC11
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Optional Button
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO2`` RF receiver (unsupported yet)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO4`` Green Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO5`` Red Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Warm White Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Cold White Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` Blue Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO15`` RF Receiver (unsupported yet)
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
|
||||||
Arilux LC06
|
|
||||||
-----------
|
|
||||||
|
|
||||||
.. table::
|
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
|
||||||
``GPIO0`` Optional Button
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Green Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO14`` Red Channel
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO15`` White Channel
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
GPIO1, Relay #1,
|
||||||
|
GPIO3, Relay #2,
|
||||||
|
GPIO13, Blue LED (inverted),
|
||||||
|
GPIO4, Optional sensor
|
||||||
|
GPIO14, Optional sensor
|
||||||
|
|
||||||
Sonoff Dual R2
|
Sonoff Dual R2
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
.. table::
|
.. pintable::
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
GPIO12, Relay #1,
|
||||||
``GPIO0`` Button 0 on header (inverted)
|
GPIO5, Relay #2,
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO10, Button,
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
GPIO13, Blue LED (inverted),
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO4, Optional sensor
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
GPIO14, Optional sensor
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO5`` Relay #2
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO9`` Button 1 on header (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO10`` Button on casing (inverted)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay #1
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Blue LED (inverted)
|
|
||||||
================================================== ==================================================
|
|
||||||
|
|
||||||
|
Sonoff Pow R1
|
||||||
|
-------------
|
||||||
|
|
||||||
|
(equivalent to Huafan SS)
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO12, Relay and Red LED,
|
||||||
|
GPIO15, Blue LED,
|
||||||
|
|
||||||
|
GPIO5, HLW8012 SEL Pin
|
||||||
|
GPIO13, HLW8012 CF1 Pin
|
||||||
|
GPIO14, HLW8012 CF Pin
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/sensor/hlw8012` for measuring power.
|
||||||
|
|
||||||
|
Sonoff Pow R2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
(equivalent to Huafan SS)
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO12, Relay and Red LED,
|
||||||
|
GPIO13, Blue LED (inverted),
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/sensor/cse7766` for measuring power.
|
||||||
|
|
||||||
|
Sonoff S20, Sonoff S22, Sonoff S26
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
See :doc:`sonoff_s20`.
|
||||||
|
|
||||||
|
Slampher
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO3, Relay and Red LED,
|
||||||
|
GPIO13, Blue LED (inverted),
|
||||||
|
GPIO1, UART RX pin (for external sensors)
|
||||||
|
GPIO3, UART TX pin (for external sensors)
|
||||||
|
|
||||||
|
Sonoff Touch
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO12, Relay and Red LED,
|
||||||
|
GPIO13, Blue LED (inverted),
|
||||||
|
GPIO1, UART RX pin (for external sensors)
|
||||||
|
GPIO3, UART TX pin (for external sensors)
|
||||||
|
|
||||||
|
Sonoff LED
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO13, Blue LED (inverted),
|
||||||
|
GPIO5, Red Channel
|
||||||
|
GPIO4, Green Channel
|
||||||
|
GPIO15, Blue Channel
|
||||||
|
GPIO12, Cold White Channel
|
||||||
|
GPIO14, Warm White Channel
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/light/rgbww` for controlling the lights together with
|
||||||
|
:doc:`/esphomeyaml/components/output/esp8266_pwm`.
|
||||||
|
|
||||||
|
ElectroDragon
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO2, Button 1 (inverted),
|
||||||
|
GPIO0, Button 2 (inverted),
|
||||||
|
GPIO13, Relay 1 and Red LED,
|
||||||
|
GPIO12, Relay 2 and Red LED,
|
||||||
|
GPIO16, Green/Blue LED
|
||||||
|
GPIO17, Analog Input
|
||||||
|
|
||||||
|
|
||||||
|
Sonoff SC
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO12, Light,
|
||||||
|
GPIO13, Red LED (inverted)
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/light/monochromatic` and :doc:`/esphomeyaml/components/output/esp8266_pwm`
|
||||||
|
for controlling the light pin.
|
||||||
|
|
||||||
|
Sonoff 4CH Pro
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Same configuration as the :doc:`Sonoff 4CH <sonoff_4ch>`.
|
||||||
|
|
||||||
|
|
||||||
|
Sonoff B1, Ai-Thinker AiLight
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/my9231`.
|
||||||
|
|
||||||
|
Sonoff T1 1CH, 2CH, 3CH
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button 1 (inverted),
|
||||||
|
GPIO12, Relay 1 and Blue LED,
|
||||||
|
GPIO9, Button 2 (inverted),
|
||||||
|
GPIO5, Relay 2 and Blue LED,
|
||||||
|
GPIO10, Button 3 (inverted),
|
||||||
|
GPIO4, Relay 3 and Blue LED,
|
||||||
|
GPIO1, UART RX pin (for external sensors)
|
||||||
|
GPIO3, UART TX pin (for external sensors)
|
||||||
|
|
||||||
|
Arilux LC10, Magic Home
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO2, Blue LED,
|
||||||
|
GPIO14, Red Channel,
|
||||||
|
GPIO5, Green Channel,
|
||||||
|
GPIO12, Blue Channel,
|
||||||
|
GPIO13, White Channel,
|
||||||
|
|
||||||
|
GPIO1, UART RX pin (for external sensors)
|
||||||
|
GPIO3, UART TX pin (for external sensors)
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/light/rgbw` for controlling the lights together with
|
||||||
|
:doc:`/esphomeyaml/components/output/esp8266_pwm`.
|
||||||
|
|
||||||
|
Arilux LC01
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO2, Blue LED,
|
||||||
|
GPIO5, Red Channel,
|
||||||
|
GPIO12, Green Channel,
|
||||||
|
GPIO13, Blue Channel,
|
||||||
|
GPIO14, White Channel,
|
||||||
|
|
||||||
|
GPIO1, UART RX pin (for external sensors)
|
||||||
|
GPIO3, UART TX pin (for external sensors)
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/light/rgbw` for controlling the lights together with
|
||||||
|
:doc:`/esphomeyaml/components/output/esp8266_pwm`.
|
||||||
|
|
||||||
|
Arilux LC11
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. pintable::
|
||||||
|
|
||||||
|
GPIO0, Button (inverted),
|
||||||
|
GPIO2, Blue LED,
|
||||||
|
GPIO5, Red Channel,
|
||||||
|
GPIO4, Green Channel,
|
||||||
|
GPIO14, Blue Channel,
|
||||||
|
GPIO13, Cold White Channel,
|
||||||
|
GPIO12, Warm White Channel,
|
||||||
|
|
||||||
|
GPIO1, UART RX pin (for external sensors)
|
||||||
|
GPIO3, UART TX pin (for external sensors)
|
||||||
|
|
||||||
|
See :doc:`/esphomeyaml/components/light/rgbww` for controlling the lights together with
|
||||||
|
:doc:`/esphomeyaml/components/output/esp8266_pwm`.
|
||||||
|
|
||||||
Sonoff S31
|
Sonoff S31
|
||||||
----------
|
----------
|
||||||
|
|
||||||
.. table::
|
.. pintable::
|
||||||
:class: no-center
|
|
||||||
|
|
||||||
================================================== ==================================================
|
GPIO0, Button (inverted),
|
||||||
``GPIO0`` Button (inverted)
|
GPIO12, Relay and Red LED,
|
||||||
-------------------------------------------------- --------------------------------------------------
|
GPIO13, Green LED (inverteD),
|
||||||
``GPIO1`` ``RX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
See :doc:`/esphomeyaml/components/sensor/cse7766` for measuring power
|
||||||
``GPIO3`` ``TX`` pin (for external sensors)
|
|
||||||
-------------------------------------------------- --------------------------------------------------
|
Shelly 1
|
||||||
``GPIO5`` Relay #2
|
--------
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO12`` Relay and red LED
|
.. pintable::
|
||||||
-------------------------------------------------- --------------------------------------------------
|
|
||||||
``GPIO13`` Green LED (inverted)
|
GPIO4, Relay,
|
||||||
================================================== ==================================================
|
GPIO5, SW Input,
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
67
github.py
67
github.py
@ -134,9 +134,76 @@ class ImageTableDirective(Table):
|
|||||||
return [table] + messages
|
return [table] + messages
|
||||||
|
|
||||||
|
|
||||||
|
class PinTableDirective(Table):
|
||||||
|
option_spec = {}
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
env = self.state.document.settings.env
|
||||||
|
|
||||||
|
items = []
|
||||||
|
|
||||||
|
data = list(csv.reader(self.content))
|
||||||
|
for row in data:
|
||||||
|
if not row:
|
||||||
|
continue
|
||||||
|
if len(row) == 3:
|
||||||
|
items.append((row[0], row[1], True))
|
||||||
|
else:
|
||||||
|
items.append((row[0], row[1], False))
|
||||||
|
|
||||||
|
col_widths = self.get_column_widths(2)
|
||||||
|
title, messages = self.make_title()
|
||||||
|
table = nodes.table()
|
||||||
|
|
||||||
|
# Set up column specifications based on widths
|
||||||
|
tgroup = nodes.tgroup(cols=2)
|
||||||
|
table += tgroup
|
||||||
|
tgroup.extend(
|
||||||
|
nodes.colspec(colwidth=col_width)
|
||||||
|
for col_width in col_widths
|
||||||
|
)
|
||||||
|
|
||||||
|
thead = nodes.thead()
|
||||||
|
tgroup += thead
|
||||||
|
trow = nodes.row()
|
||||||
|
thead += trow
|
||||||
|
trow.extend(
|
||||||
|
nodes.entry(h, nodes.paragraph(text=h))
|
||||||
|
for h in ('Pin', 'Function')
|
||||||
|
)
|
||||||
|
|
||||||
|
tbody = nodes.tbody()
|
||||||
|
tgroup += tbody
|
||||||
|
for name, func, important in items:
|
||||||
|
trow = nodes.row()
|
||||||
|
entry = nodes.entry()
|
||||||
|
para = nodes.paragraph()
|
||||||
|
para += nodes.literal(text=name)
|
||||||
|
entry += para
|
||||||
|
trow += entry
|
||||||
|
|
||||||
|
entry = nodes.entry()
|
||||||
|
if important:
|
||||||
|
para = nodes.paragraph()
|
||||||
|
para += nodes.strong(text=func)
|
||||||
|
else:
|
||||||
|
para = nodes.paragraph(text=func)
|
||||||
|
entry += para
|
||||||
|
trow += entry
|
||||||
|
tbody += trow
|
||||||
|
|
||||||
|
table['classes'] += ['no-center']
|
||||||
|
self.add_name(table)
|
||||||
|
if title:
|
||||||
|
table.insert(0, title)
|
||||||
|
|
||||||
|
return [table] + messages
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.add_role('libpr', libpr_role)
|
app.add_role('libpr', libpr_role)
|
||||||
app.add_role('yamlpr', yamlpr_role)
|
app.add_role('yamlpr', yamlpr_role)
|
||||||
app.add_role('docspr', docspr_role)
|
app.add_role('docspr', docspr_role)
|
||||||
app.add_role('ghuser', ghuser_role)
|
app.add_role('ghuser', ghuser_role)
|
||||||
app.add_directive('imgtable', ImageTableDirective)
|
app.add_directive('imgtable', ImageTableDirective)
|
||||||
|
app.add_directive('pintable', PinTableDirective)
|
||||||
|
Loading…
Reference in New Issue
Block a user