Comments (5)
Can you provide an example for this? The select entity exposed to HA uses an index, not a string. Setting the value via an arbitrary text value might not work, as it would have to match exactly, so what should happen if it matches none of the options?
from esphome.
I may have ran a bit fast... :)
End goal is to present in LVGL a dropdown, roller or btnmatrix mirroring a select from HA corresponding to some other integration. Like in the examples from the cookbook, you use a switch widget in LVGL to toggle an arbitrary light switch in HA, or adjust various other entities, you need to retrieve their state first from HA with platform: homeassistant
kind of sensor first.
For example you have in HA a select.ventilation_system
(provided by some other integration) with some presets:
options:
- Base
- Mid
- High
- Turbo
- Off
icon: mdi:fan
friendly_name: Ventilation presets
This select's state can only be a textual value, one of the options listed eg. state: Base
We could create a dropdown, roller or btnmatrix in LVGL with exactly these options (also see #46):
lvgl:
...
- dropdown:
id: vent_dropdown
options:
- Base
- Mid
- High
- Turbo
- Off
and a text sensor to retrieve the state, which would have to use a resolution function to update the dropdown't selected value by the name, since there's no index available:
text_sensor:
- platform: homeassistant
id: ventilation_system_select_state
entity_id: select.ventilation_system
on_value:
- lvgl.dropdown.select:
id: vent_dropdown
item_name: !lambda return x.c_str(); #or similar
what should happen if it matches none of the options
Nothing, just a warning in ESPHome log (the chances to occur would be minimized if #46 would be possible).
Moreover, if we would have on_value
for dropdown/roller/btnmatrix, we could do the reverse, update the select in HA based on the choice made here as described in #49.
from esphome.
Just use a select linked to the roller/dropdown, and use automations in HA to sync with something else.
select:
- platform: lvgl
dropdown: lv_dropdown
name: LVGL Dropdown
from esphome.
use automations in HA to sync with something else.
The above described approach would be better in the sense that the whole procedure would be done in a single place, the ESPHome node. Wouldn't require additional configs to maintain in the middleware (HA). Pretty much the same reason as why avoiding MQTT in general.
Plus afaik there's no easy way to sync entities to each other in HA (say, two select
s), there's always the possibility to enter in a sync loop etc. Harder for users...
from esphome.
At least if we could have lambda equivalents for this. Say, consider this an advanced use case, which typically lambdas are apropriate for.
from esphome.
Related Issues (20)
- Font kerning HOT 1
- Formatted text for widget updates HOT 1
- QR code
- Graph as image HOT 2
- VNC: host binary crashes on client disconnect
- VNC and `graphical_display_menu` don't play nicely together HOT 3
- Custom component/code integration for pages, widgets, etc. HOT 6
- Lvgl on e-paper crash (TTGO T5_V2.3_2.13) HOT 2
- Compile error in LVGL after last commit. HOT 6
- FR: `udp` sensor from multiple providers
- FR: `udp` text sensor
- FR: `udp` arbitrary data with actions and triggers HOT 1
- FR: `udp` repeat messages
- Page's `skip` option to be set at runtime
- FR: `udp` multiple instances HOT 2
- disp_bg_image error HOT 1
- Additional ST7701s initialization request HOT 6
- Import of SVG files not working correctly with LVGL HOT 4
- Arc is clickable outside of range HOT 1
- Raised issues in ESPHome issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esphome.