6809d3b941
GitHub issue #7 asked for cover.toggle on tap. ESP Screens now asks Home Assistant which actions each entity has instead of keeping lists: the editor offers On / off (covers included), sliders, controls and displays only where Home Assistant has the action, and refuses only new unsupported settings. Perform action runs any action Home Assistant offers for the tile's entity, under its own names and fields; the screen sends it with a call id and says Refused when Home Assistant refuses. Sensors round by display precision, and tiles, the top bar, timelines, vacuum chips and the inspector use Home Assistant's words where they showed raw states. Tiles show Home Assistant's icons, picked as its frontend does (the fonts grow to 309 glyphs). Existing screens keep every setting and tap as before: stored layouts load leniently, legacy taps route the same (1020 combinations), and messages are byte-identical without Home Assistant's words and icons. Firmware 0.2.58. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
19 lines
870 B
Python
19 lines
870 B
Python
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.components import text
|
|
from esphome.const import CONF_ID
|
|
|
|
AUTO_LOAD = ["json"]
|
|
|
|
ns = cg.esphome_ns.namespace("smart_display")
|
|
DashboardInbox = ns.class_("DashboardInbox", text.Text, cg.Component)
|
|
CONFIG_SCHEMA = text.text_schema(DashboardInbox, mode="TEXT", entity_category="config").extend(cv.COMPONENT_SCHEMA)
|
|
|
|
async def to_code(config):
|
|
# A tap asks Home Assistant whether it took the action (firmware 0.2.58+): ESPHome's own action responses, which it
|
|
# otherwise only compiles in for a YAML homeassistant.action with on_success or on_error.
|
|
cg.add_define("USE_API_HOMEASSISTANT_ACTION_RESPONSES")
|
|
var = cg.new_Pvariable(config[CONF_ID])
|
|
await cg.register_component(var, config)
|
|
await text.register_text(var, config, min_length=0, max_length=255, pattern=None)
|