mirror of
https://git.steelants.cz/JonatanRek/ESPHomeMarlin2.git
synced 2026-10-11 17:44:36 +00:00
Progress
This commit is contained in:
1 parent
e04fd29b1d
commit
1d31a8b63f
2 files changed
+31
-9
No files matched your search
@@ -0,0 +1,21 @@
|
|||||||
|
# A component that reads CSV values from the uart.
|
||||||
|
|
||||||
|
A configured uart is required.
|
||||||
|
|
||||||
|
Configure a list of sensors. The index is required, the rest is the standard sensor config.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```yaml
|
||||||
|
sensor:
|
||||||
|
- platform: serial_csv
|
||||||
|
uart_id: my_uart # optional
|
||||||
|
sensors:
|
||||||
|
- index: 0
|
||||||
|
name: First value
|
||||||
|
- index: 3
|
||||||
|
name: Fourth value
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/ssieb/esphome_components/tree/master/components/serial_csv
|
||||||
|
https://github.com/esphome/esphome/blob/dev/esphome/components/dht/sensor.py#L34
|
||||||
@@ -3,25 +3,26 @@ import esphome.config_validation as cv
|
|||||||
from esphome import automation
|
from esphome import automation
|
||||||
from esphome.components import uart
|
from esphome.components import uart
|
||||||
from esphome.components import sensor
|
from esphome.components import sensor
|
||||||
from esphome.const import CONF_ID, CONF_INDEX, CONF_SENSORS
|
from esphome.const import CONF_ID, CONF_INDEX, CONF_SENSORS, CONF_HUMIDITY, CONF_MODEL, CONF_PIN, CONF_TEMPERATURE, STATE_CLASS_MEASUREMENT, UNIT_CELSIUS, UNIT_PERCENT, DEVICE_CLASS_TEMPERATURE
|
||||||
|
|
||||||
CODEOWNERS = ["@ssieb"]
|
CODEOWNERS = ["@jonatanrek"]
|
||||||
|
|
||||||
DEPENDENCIES = ['uart']
|
DEPENDENCIES = ['uart']
|
||||||
|
|
||||||
serial_ns = cg.esphome_ns.namespace('serial')
|
serial_ns = cg.esphome_ns.namespace('serial')
|
||||||
|
|
||||||
SerialCSV = serial_ns.class_('SerialCSV', cg.Component, sensor.Sensor, uart.UARTDevice)
|
Marlin2 = serial_ns.class_('Marlin2', cg.Component, sensor.Sensor, uart.UARTDevice)
|
||||||
|
|
||||||
CONFIG_SCHEMA = uart.UART_DEVICE_SCHEMA.extend(
|
CONFIG_SCHEMA = uart.UART_DEVICE_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.declare_id(SerialCSV),
|
cv.GenerateID(): cv.declare_id(Marlin2),
|
||||||
cv.Required(CONF_SENSORS): cv.ensure_list(
|
cv.Required(CONF_SENSORS): cv.ensure_list(
|
||||||
sensor.SENSOR_SCHEMA.extend(
|
cv.Optional("bed_current"): sensor.sensor_schema(
|
||||||
{
|
unit_of_measurement=UNIT_CELSIUS,
|
||||||
cv.Required(CONF_INDEX): cv.positive_int,
|
accuracy_decimals=1,
|
||||||
}
|
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||||
)
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user