Comments (8)
true. for other sensors atc the on_value
can be useful indeed.
from esphome.
I was just thinking when i was playing with the button on_click event.
Would it be nice to have the "homeassistant.service" build into the widgets directly.
so you have for example:
- btn:
checkable: true
id: btn_toggle_swicth
widgets:
- label:
id: lbl_btn_apa_lampa
align: center
text_color: 0xFFFFFF
symbol: CLOSE
homeassistant.service:
entity_id: light.to_be_toggled
send: light.turn_off
receive:
state:
checked: !lambda return x;
- dropdown:
x: 80
y: 180
width: 105
id: dropdown_id
options:
- Dry food
- Wet food
- Semi-moist
homeassistant.service:
entity_id: light.to_be_toggled
send:
action: light.turn_off
option: !lambda return (n.c_str());
receive:
value: !lambda return x;
from esphome.
receive
?
from esphome.
Yes, that would be like a short way of:
binary_sensor:
- platform: homeassistant
publish_initial_state: true
id: "light_totom"
entity_id: light.woonkamer_kleuren_totom_light_1
on_state:
- lvgl.widget.update:
id: lv_button0
state:
checked: !lambda return x;
from esphome.
But that's exclusive to homeassistant.service
, right? Still need on_value
for regular esphome automations...
from esphome.
Was thinking about this homeassistant.service
and I think we still need the binary sensor though, to get the initial state of the entity from HA, to display it before calling the service.
from esphome.
Ran into a use case with a switch:
- switch:
id: swi_klima
x: 45
y: 68
align: TOP_MID
width: 70 #75
height: 40
on_release:
- if:
condition:
lambda: return lv_obj_get_state(id(swi_klima)) & LV_STATE_CHECKED;
then:
- homeassistant.service:
service: climate.set_hvac_mode
data:
hvac_mode: !lambda |-
if (id(bs_climate_heat_mode).state == true) {
return "heat";
} else {
return "cool";
}
entity_id: climate.haloszoba_klima
else:
- homeassistant.service:
service: climate.turn_off
data:
entity_id: climate.haloszoba_klima
We could just use x
here instead of lv_obj_get_state(id(swi_klima)) & LV_STATE_CHECKED
in an on_value
trigger.
Not sure if things like on_turn_on
and on_turn_off
or more LVGL-specialised on_check
and on_uncheck
would be worth it.
from esphome.
Works with all event triggers now.
from esphome.
Related Issues (20)
- Currently active page variable or sensor HOT 5
- Lambdas for widgets states/flags HOT 1
- `lvgl.is_idle` condition, timeout required HOT 7
- LVGL sensors HOT 1
- `transform_angle`, `transform_zoom` failure
- 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 5
- 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
- FR: `udp` repeat messages
- Page's `skip` option to be set at runtime
- FR: `udp` multiple instances 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.