HA SwitchPlate HASPone: DIY In-Wall Touchscreen Home Assistant Controller

That’s a Home Assistant template, which utilizes the Jinja2 templating language.

{{states.sensor.pws_precip_today_in.state|round(2)}} should do the trick

I thank Luma for the great work he has distributed.
I discovered this project recently and I realized it with such enthusiasm.
I made the horizontal version of the display and I have the .tft file available.

I have a problem with a toggle page where I inserted a Tuya socket.
In Home Assistant, the Tuya switch is “switch.123456789xx” but if I insert it in the Toggle color automation I get a validation error, while if I insert Sonoff switches, everything is done.
I can not figure out if the problem is related to entity_id or payload template

Toggle colors when light changes

  • alias: hasp_plate01_p3_ToggleColor2
    trigger:
    • platform: state
      entity_id: switch.123456789xx
    • platform: state
      entity_id: ‘binary_sensor.plate01_connected’
      to: ‘on’
    • platform: homeassistant
      event: start
    • platform: state
      entity_id: input_number.hasp_plate01_selectedbackgroundcolor
    • platform: state
      entity_id: input_number.hasp_plate01_unselectedbackgroundcolor
    • platform: state
      entity_id: input_number.hasp_plate01_selectedforegroundcolor
    • platform: state
      entity_id: input_number.hasp_plate01_unselectedforegroundcolor
      action:
    • service: mqtt.publish
      data:
      topic: ‘hasp/plate01/command/p[3].b[5].bco’
      payload_template: >-
      {% if states.switch.123456789xx.state == “on” -%}
      {{ states.input_number.hasp_plate01_selectedbackgroundcolor.state | int }}
      {%- else -%}
      {{ states.input_number.hasp_plate01_unselectedbackgroundcolor.state | int }}
      {%- endif %}
    • service: mqtt.publish
      data_template:
      topic: ‘hasp/plate01/command/p[3].b[5].pco’
      payload_template: >-
      {% if states.switch.123456789xx.state == “on” -%}
      {{ states.input_number.hasp_plate01_selectedforegroundcolor.state | int }}
      {%- else -%}
      {{ states.input_number.hasp_plate01_unselectedforegroundcolor.state | int }}
      {%- endif %}

Validation reports this error:
invalid config for [automation]: invalid template (TemplateSyntaxError: expected token ‘end of statement block’, got ‘aef465’) for dictionary value @ data[‘action’][1][‘data_template’][‘payload_template’]. Got None. (See /config/configuration.yaml, line 283). Please check the docs at Automation - Home Assistant

Give me some help.
thank you

If you could save your configuration to hastebin.com and then paste a link here we could probably help you figure out what’s going wrong. Likely just a yaml thing, but the way you’ve posted here prevents further troubleshooting as the forums eat whitespace and whitespace is probably the issue here.

I reported the configuration part on hastebin.
When I add the final part of the code, the verification goes into error. This is a tuya switch in the cloud that is not managed directly by Home Assistant.
Cattura

Hastebin configuration page 6

thank you
double68

Does this work?

https://hastebin.com/wotomujuwu.yaml

1 Like

Luma, it works !!!
Where could I learn the language of these templates?
For me they are still complicated!

Many many thanks.

1 Like

I’d start with the Home Assistant template docs and the Jinja2 template docs.

1 Like

This project keeps getting better!

I had an automation to turn off the display backlight after a few seconds without any motion detected, but it no longer works. I think it’s because there’s an automation which changes the page after a few seconds without any motion detected…?
How could I merge the two?

Ideally it’d be nice to make it fade up with motion and fade down with inactivity, if possible.

Are these screens subject to burn ins?

Thanks in advance!

Screen burn shouldn’t be a problem with modern LCDs, but dimming is useful in many situations. Can you post your automation somewhere so we could take a look at it?

Here’s what I had:

  • id: ‘1541284668746’
    alias: Plate01 backlight pir ON
    trigger:
    • entity_id: binary_sensor.plate01_motion_sensor
      from: ‘off’
      platform: state
      to: ‘on’
      condition: []
      action:
    • data:
      brightness: 50
      entity_id: light.plate01_backlight
      service: light.turn_on
  • id: ‘1541286095235’
    alias: Plate01 backlight pir OFF
    trigger:
    • entity_id: binary_sensor.plate01_motion_sensor
      for: ‘20’
      from: ‘on’
      platform: state
      to: ‘off’
      condition: []
      action:
    • data:
      entity_id: light.plate01_backlight
      service: light.turn_off

Thanks

I’ve done horrible things to luma’s wonderful desk mount by hacking it up in Solidworks. I added a bump to the top of the enclosure that will allow you to just keep the connector on the PCB that comes with the Nextion panel… This way you don’t have to desolder it.

Why yes, I’m that lazy.

I also plan to modify the enclosure back to just support a Wemos D1 without using the HA Switchplate PCB (as I want to save those for the in-wall installations). In the interim mine’s just going to be floating around in there and will be kept in place by the now-structural USB cable.

Anyway, figured I’d share. The files should be printable but probably aren’t in proper printing orientation.

For now I forked luma’s project and uploaded them to github here:

Once they’re complete as I’d really like them I’ll submit a pull request.



Super cool! However… the existing desktop model works without removing the LCD connector and has a cutout for access to the connector so you can use it to test/develop other non-HASP projects too. Alternately, you can skip soldering all together and just use the normal cable but it would have to be run outside the case a bit.

Your enclosure looks like you could still use the connector with no soldering to the back of the LCD while keeping the cables inside the project, is that true?

Try deleting the file packages/plate01/hasp_plate01_00_motionsensor.yaml and that should disable the packaged motion sensor page-changing automation, leaving your own automation to do its thing without conflict.

I like the automation that calls up a specific page when there’s movement; any way to keep the two?

Thanks

Does someone recognize the problem that the printed desktop front prevent the touch to work?

If touch isn’t working confirm that “TX” from the panel (blue wire) is connected correctly back to the PCB. I don’t know of any mechanism by which the enclosure would be able to interfere with touch function.

I’m not sure that I understand exactly what what’s happening. Can you explain a bit about what it’s doing right now, and how you would like it to behave?

Awesome project!

Currently working on wiring up my house and want to implement this in several rooms.
Would it be good to power via PoE? I was thinking PoE to micro-usb and feed the nextion from the wemos? Looks like there’s a 5v out from wemos?

If anyone has done this with elko-type boxes which we use here in Norway I’d be interested to know if that works.

The opening for a single switch is 56x56mm (the visual area), I know the active area on the display is about 60mm but I think it should be possible to cut a bit into top/bottom to fit the screen. A typical frame I am talking about with multiple switches etc… looks like this: http://m.proff.elko.no/getfile.php/13125080/produkter/doc/EKO04362/Datasheet1427486.pdf

As you can see on this picture, there’s a blind plate separating each: https://onnshop.onninen.com/pimimg/images/NOEFO_40_82821_1600x1200.jpg

So as I am going to install switches as well I was thinking about getting a double elko-box which is open all the way, like this one: https://picture.elektroimportoren.no/pictures/1223791.jpg

I like what you’ve done, having the page change if motion is detected. I would like to add to that by having the back light come on if motion is detected, and turn off after a few seconds of inactivity.

Right now my automation is overidden by yours it seems, so the screen is always on.

I hope that makes sense.
Thanks

@JBS
Have the same issue in another project using the nextion.
Try loosen the screws a bit, in my case the Front housing is pressing against the Touch panel