I took over an existing yalm project, thanks to the answer I finally managed to start my configuration, and by quietly copying and modifying the yalm with the hmi I can gradually make my interface now.
Currently I am stuck on the correspondence of the ids between the yalm, and the ids of the images of the hmi on nextion. Notament for the weather icons, no id used in the yalm file correspond with the id in the hmi project, and I do not understand how to get the right icon under an if condition.
look under the weather section in marcfagers yaml. you see where it has âsymbolâ in the weather section?? this is referencing the pictures idâs in the nextion editor. whichever symbol number you have there will be the symbol that is displayed. Iâm not at my pc right now but hopefully this helps.
pedroKTFC has brought them out as substitutes in his answer so all images are easier to change in one location without needing to scroll through 1000s of lines of code(unfortunately these yaml files can get messy). notice at the bottom of the weather section the âif statementsâ that there is the command to update the screen with whatever image. the same as pedroKTFC posted, although heâs showing another component instead of the weather. (his boilerâŚ) he is calling for image id number 14 for when its in the off state and image 13 when its in the on state.
this line is saying your updating disp1 at a page called Home and picture components called HWBoost, the â.picâ is the image field in the tft files picture component, finally the %i is an int⌠look through the marcfager files and see how everything in the yaml corresponds to the tft.
From what I understood it is indeed the order of the images so id is indeed equal to id of hmi, but when the files are modified then the order changes, and it quickly becomes a mess. I donât understand how the substitution works, itâs interesting Iâll try to understand how you do it.
In any case here is the progress of this night. I designed the weather icons, and used several functions and everything works well, thank you for the advice!
yes the order of images you import into the nextion editor is the ID, i know if you delete one then the editor auto alters your image idâs in the components .pic attributes but it wonât obviously alter anything in the yaml. i just add a new one each time then delete the old and move the new into the same location (within the imported images, nextion editor bottom left). that or add a new one and change its id in yaml and nextion editor to suit. The substitutes are like fixed variables ⌠in other words if you have them for names or idâs and use the $somename in your code multiple times. you can then just change the substitute for something other than âsomenameâ like to âanothernameâ by just doing the one edit in substitutes. hope that makes sense (obviously they arenât variables because you canât alter the values programmatically)
yes I fully understand. It seems logical, I would code the same way under python. instead of modifying everything, a single variable contains the value of the id of nextion and the yalm refers to a library of variables, it allows you to change only one id rather than the whole yalm. Where it is absolutely necessary to respect the order of the ids under nextions, it is also what I did, but I prefer the variable technique. just better work.
/config/esphome/ns-panel.yaml: In lambda function:
/config/esphome/ns-panel.yaml:869:84: warning: too many arguments for format [-Wformat-extra-args]
- lambda: id(disp1).send_command_printf("Alarm.TimerCounter.val", "%s", id(alarm_delay).state);
I cannot figured out the correct lambda syntaxâŚ
Does anyone have a clue?
does the above help? is the value an int? this is how masto or marcfager has it in the number component for passing the brightness to a variable in the HMI.
Salvation !
Almost everything is working for me now. I am currently looking to change the text when a button state changes so print on a button on or off when it is activated or not. I thought so headed for :
I think you can do something like this, where targetTemp is the objname of the Nextion object. This has the advantage itâs independent of id so wonât change as you add remove other objects. I donât know if this can be done for other attributes as that would remove that id dependence.
Thank you for the help, little by little Iâm moving forward and once the solution is found, itâs easy to make basic templates.
I still have a small problem, more recalcitrant than the others.
I want to retrieve the % lighting of a dimmer under tasmota (sonoff D1)
Only impossible to recover the data.
here is the yalm configuration of the button under home functional assistant:
it is however exactly the same yalm configuration as for the temperature and therefore I do not understand why it does not work. And I know even less how to fix the error. Iâve only been doing trial and error since yesterday by recovering bits of code on various projects.
thank you again for the help, I would really like this project to be completed to make it my first shared project on github!
it works thank you! Any idea what I could do to not print anything when the switch is off? everything works now, but I canât get anything to print. I have to put for example â-â
secondary info?? shouldnât that be âattrâ ??
leve the text field blank in the hmi. and in the yaml if statement print ââ if button state is off.
I had to figure out how print works and remove decimals with %.0f
As the sensor has a scale of 0 to 255 I wrote the calculation to bring it back to 100% to my surprise everything works fine.
Itâs an effect an attribute!
Coming back to the condition I am trying to use lambda and the if condition, but I canât write it properly.
I canât really find the documentation because I donât have a sufficient level of mastery to still understand them. Itâs only my basics of python that serve me and of course on this forum!
Then this which allows to change if the value must be displayed or not on the other hand I am obliged to write â.â if I want to change this value, otherwise I stay on the last value of the dimmer:
I would like to try a cleaner code, and especially remove the â.â but it doesnât matter if this value should stay with a font color I can make it not visible