This commit is contained in:
2025-09-13 23:06:54 +02:00
parent 91f2dd54be
commit cf3039439f
3 changed files with 111 additions and 63 deletions

View File

@@ -13,13 +13,19 @@ CONFIG_SCHEMA = cv.Schema(
cv.Optional("printer_state"): text_sensor.text_sensor_schema(
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
cv.Optional("sd_card_files"): text_sensor.text_sensor_schema(
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
cv.Optional("sd_card_file_selected"): text_sensor.text_sensor_schema(
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
}
).extend(cv.polling_component_schema("15s"))
async def to_code(config):
server = await cg.get_variable(config[CONF_MARLIN])
for sName in ["printer_state"]:
for sName in ["printer_state", "sd_card_files", "sd_card_file_selected"]:
if sName in config:
sens = await text_sensor.new_text_sensor(config[sName])
cg.add(server.add_text_sensor(sName,sens))