Everything work now thank for your Help everyone
Would like to share a little update on my project
It got to a point where it has the following features:
- Entities Page with support for cover, switch, input_boolean, sensor, button, input_button and light
- Detail Pages for Lights (Brightness, Temperature and Color of the Light) and for Covers (Position)
- Thermostat Page
- Media Player Card
- Screensaver Page with Time, Date and Weather Information
Everything is configured with yaml looking like this, manged by an AppDamon Script, available in HACS.
pages:
- type: cardEntities
heading: Example Page 1
items:
- cover.example_cover
- switch.example_switch
- light.light_example
- sensor.example_sensor
- type: cardThermo
heading: Exmaple Thermostat
item: climate.example_climate
- type: cardMedia
heading: Exampe Media
item: media_player.spotify_user
And here are some screenās from the design of the display firmware:
Salvation ! I took a good look at your configuration and I took over the multi_click used on some of your buttons. however, I have a problem using it. if I keep pressing for example to change page on a long press, binary sensor remains in āpressā position as long as I donāt put it back.
I canāt manage to deactivate it automatically after a page change or a timer. I tried several functions of nextion like āclick 4.0ā but without effects after 2 days of trying and relentlessly
I have this code for setting an input boolean on a button click. maybe you could do similar?
on_click:
- homeassistant.service:
service: homeassistant.turn_on
data:
entity_id: input_boolean.play_smoothfm
- delay: 0.2s
- homeassistant.service:
service: homeassistant.turn_off
data:
entity_id: input_boolean.play_smoothfm
edit: sorry i now realize what you are stuck with . do you have on_release checkbox ticked in the nextion editor?
yes, the button works fine on the page itself. but when the hold is performed for a page change, then HA continues to receive a press input. and this until an action is performed on the button. (I also tried on several types of button, touch, txt, but itās the same thing for everything)
- platform: nextion
name: "$friendly_name touch_zone_spot_led"
id: touche_zone_spot_led
component_name: m0
page_id: 2
component_id: 6
on_release:
then:
- homeassistant.service:
service: switch.toggle
data:
entity_id: switch.spots_led
on_multi_click:
- timing:
- ON for at least 0.2s
then:
- lambda: 'id(disp1).send_command_printf("page 5");'
Alright well I finally found a āloopholeā. To play with timers (itās your code that inspired me) here is my configuration :
- platform: nextion
name: "$friendly_name touch_zone_spot_led"
id: touche_zone_spot_led
component_name: m0
page_id: 2
component_id: 6
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Short Clicked"
- homeassistant.service:
service: switch.toggle
data:
entity_id: switch.spots_led
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- logger.log: "Double Clicked"
- lambda: 'id(disp1).send_command_printf("page 5");'
hmmmm i have it in my code working fine. i have a on_click for single press and a on_multiclick with 1s set for long press.
thatās what I had. But during the multi click, if there is no ādeclickā before changing the page, home assistant continues to see the sensor as āpressedā and when returning to this menu, you must first press the button , so that home assistant sees it as āreleasedā so it makes a ghost key
I have started to make my own configuration with NSPanel, ESPHome and my own UI in Nextion.
I have a question, Iām planing to have one button on the display to toggle on/off to turn on/off light, and Iām planing to have button above to bright or dim a light (see the arrows above and below the icon for the lamp).
What would you say would be the easiest way to make the arrow buttons dim or bright?
The way to use buttons for increasing and decreasing have been shown in earlier posts, especially for increasing/decreasing thermostat temperatures. I donāt know how you plan to make them work but some things Iād probably consider:
- You probably donāt want them activated by accident when someone taps the on/off but misses and taps on the increase/decrease button. So Iād do something like only activate them when someone holds their finger on them longer than a certain time.
- Then, while someone holds their finger on the button, increase the brightness in fixed steps (say 5%) every half a second (or whatever works out best) and stops when the finger is removed.
Good luck
Iāll be interested to see how that works out!
OK, will have a look,
So I make some changes in ESPHome yaml file and some automation in HA?
Sorry Iām a noob when it comes to this
A good place to start is here. There are various links in his comments that provide further useful background. Try and understand his yaml file then look at the yaml files the likes of myselff, @lovejoy777 etc have posted above which include elements of what you want to do, but probably not the whole thing.
You can probably do everything in the yaml file, you shouldnāt need automations in HA.
All examples I have seen so far is that it increase or decrease 1 or what ever you set for one click on the button. Iām looking for some how that it should increase or decrease while I hold the button pressed. Not only x numbers and I need to press again. I havenāt seen anything like that. I have also seen sliders, but not what Iām looking for
you will need a loop in your on_multiclick. look here, he is using a loop in esphome. although heās using it to set brightness in steps with time, i presume you can alter the code to achieve what you want.
This is my dimmer yaml that cycles through Dim ā Bright ā dim with a single hold. release and hold again and the cycle reverses. Single click is on/off toggle.
do you mind sharing the hmi file (Nextion file) or havenāt you changed to custom UI?
here is the start of my new thermostat page
I use the default HMI and the nspanel component to send/receive JSON to control the widgets.