Planning and setup - ESP32-S3 - 4848S040 - 480*480 IPS touchscreen

Where?

----------UPDATE----------
The display attributes are set in the configuration.yaml:

#---------- OpenHASP ----------#
template:
  - binary_sensor:
    - name: Display settings
      unique_id: ba031c34-fe93-42cb-8c0c-ebd44cb8750f # https://www.uuidgenerator.net/
      state: "{{ now() - state_attr(this.attributes.update_automation | default('automation.update_display_data'), 'last_triggered') > timedelta(seconds=this.attributes.update_time | default(120) |int ) }}" # change the default automation entity_id from step 3 before
      delay_on:
        seconds: 2
      attributes:
        update_automation: "automation.update_display_data"
        update_time: "80" # sending the config via mqtt needs some time to complete. This stops the automation from re.run before sending config is finished
        display_w: "480"
        display_h: "480"
        grid_cols: "12" # increase for more resolution of object
        grid_rows: "12" # increase for more resolution of object
        grid_gutter: "8" # This looked nice for me
        grid_margin: "4" # This looked nice for me
        bg_color: "#000000"  #Black
        primary_color: "#4193d5" #Moderate Blue
        secondary_color: "#ee9f52"  #Soft orange
        accent_color: "#A175C4" #Slightly desaturated violet
        success_color: "#6cbe58" #Moderate lime green
        warning_color: "#d67430" #Strong orange
        error_color: "#e25628" #Bright red
        radius: "4"
    

"val": '{{ 1 if is_state("switch.officelight") == "on" else 0 }}'

Fiddling with pages.jsonl gave me this:

Thanks for the tip.
I used the example in the openHASP Custom Component, substituting my entities. And since this is the only plate, I kept the name as “plate”.

But I think the non-responsiveness of the button is because MQTT is not connecting? Running MQTT Explorer, I don’t see any MQTT traffic to or from the plate.

Are the MQTT set right? What’s the yourplate_IP/config/mqtt 's content?

The openHASP (HACS) integration is ok in the HA?

Something similar should be in the MQTT explorer:

MQTT

Your assistance is appreciated.

First the MQTT settings. My MQTT broker is open, so there is no user/password.

I am not using the integrated MQTT broker. My broker is on a separate Raspberry Pi3*

After a couple of reboots, this is what I see on MQTT Explorer:

“plate” is seen on MQTT, but there is no I/O.

My other HASP devices are HA SwitchPlates working fine.

*My MQTT broker predates my use of Home Assistant by more than a year. A number of my MQTT devices have the broker IP hard-coded and it is easier to just keep the broker where it is instead of using the integrated broker. Which would require a lot of re-flashing.

Which openHASP version did you install? 0.63 didn’t work properly( maybe same problem, than yours), but the 0.7.0 rc12, nightly build is ok.

about

Here’s the terminal output from startup. It is obvious that the MQTT server is not connecting… But why?


        open____ _____ _____ _____
          |  |  |  _  |   __|  _  |
          |     |     |__   |   __|
          |__|__|__|__|_____|__|
        Home Automation Switch Plate
        Open Hardware edition v0.7.0-rc12

[18:45:08.441][212980/248460 14][    0/    0  0] DBUG: Started @ 115200 bps
[1B][1000D[1B][0K#[1B][1000D[1B][0C[18:45:08.450][212980/248460 14][    0/    0  0] DBUG: Environment: esp32-s3-4848s040_16MB
[1B][1000D[1B][0K#[1B][1000D[1B][0C[18:45:08.460][212980/248460 14][    0/    0  0] UART: Started
[1B][1000D[1B][0K#[1B][1000D[1B][0C[18:45:08.468][212980/248460 14][    0/    0  0] UART: Client login from serial
[1B][1000D[1B][0K#[1B][1000D[1B][0C[18:45:08.488][212980/248360 14][    0/    0  0] CONF: SPI flash FS mounted
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.505][212980/248360 14][    0/    0  0] CONF: Loading /config.json
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.516][212980/247592 13][    0/    0  0] CONF: Loaded /config.json
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.525][212980/248424 14][    0/    0  0] DBUG: Loading debug settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.535][212980/248424 14][    0/    0  0] GPIO: Loading GUI settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.545][212980/248424 14][    0/    0  0] GUI : First Touch Calibration enabled
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.555][212980/248424 14][    0/    0  0] HASP: Loading HASP settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.565][212980/248424 14][    0/    0  0] WIFI: Loading WiFi settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.596][212980/246500 13][    0/    0  0] MQTT: Loading MQTT settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.614][212980/246500 13][    0/    0  0] TELN: Loading Telnet settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.624][212980/246500 13][    0/    0  0] MDNS: Loading MDNS settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.634][212980/246500 13][    0/    0  0] HTTP: Loading HTTP settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.643][212980/246500 13][    0/    0  0] GPIO: Loading GPIO settings
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.653][212980/246500 13][    0/    0  0] CONF: Settings loaded
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[18:45:08.714][204788/217688  5][    0/    0  0] WIFI: Connecting to iot
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:08.726][204788/217564  5][    0/    0  0] MSGR: Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:08.735][204788/217564  5][    0/    0  0] MSGR: Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:08.743][204788/217564  5][    0/    0  0] TFT : Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:08.752][204788/217540  5][    0/    0  0] TFT : Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.014][204788/215384  4][    0/    0  0] TFT : Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.041][204788/215384  4][    0/    0  0] TFT : Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.132][204788/215384  4][    0/    0  0] LVGL: Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.145][155636/166016  6][62608/62832  1] LVGL: LV_FS_PC ready
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.155][131060/140844  6][61908/61956  1] GUI : Initialize Cursor
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.668][131060/140076  6][61816/61840  1] DRVR: GT911 Started (480x480)
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.683][131060/140076  6][61816/61840  1] DRVR:     *  Found device 0x5d
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.696][131060/139976  6][61576/61592  1] LVGL: Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.713][131060/139976  6][59116/59756  2] HASP: Custom theme loaded
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.730][131060/139976  6][58564/58568  1] HASP: Loading /pages.jsonl
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.750][122868/133676  8][58324/58324  0] LVGL: /littlefs/22.bin
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.762][122868/133272  7][58244/58248  1] LVGL: Ascender:   1344
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.771][122868/133272  7][58244/58248  1] LVGL: Descender:  -384
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.780][122868/133272  7][58244/58248  1] LVGL: Lineheight: 26
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.789][122868/133272  7][58244/58248  1] LVGL: Baseline:   6
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.798][122868/133272  7][58244/58248  1] LVGL: Underline:  -3
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.807][122868/133272  7][58244/58248  1] LVGL: Underline:  1
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.830][122868/139532 11][57492/57500  1] HASP: Loaded /pages.jsonl
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.840][122868/139532 11][57492/57500  1] HASP: Changing page to 1
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.849][122868/139532 11][57332/57340  1] GPIO: Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.858][122868/139532 11][57332/57340  1] GPIO: Reboot counter 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.867][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.876][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.885][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.894][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.903][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.912][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.921][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.930][122868/139532 11][57332/57340  1] GPIO: Invalid pin 0
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.939][122868/139532 11][57332/57340  1] GPIO: Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.948][122868/135096  9][57332/57340  1] HTTP: Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.958][122868/134528  8][57332/57340  1] TELN: Telnet console started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.968][122868/134528  8][57332/57340  1] FTP : Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:09.977][122868/134528  8][57332/57340  1] FTP : Disabled
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:10.007][122868/134528  8][57332/57340  1] MSGR: File not found: L:/boot.cmd
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:10.021][122868/133456  7][57332/57340  1] MQTT: hasp/plate/LWT
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:10.031][122868/133408  7][57332/57340  1] MQTT: hasp/plate/LWT
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:10.040][122868/133564  8][57332/57340  1] MQTT: plate_c969b8
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:10.050][114676/122740  6][14:45:10.050][57332/57340  1] MQTT: Starting...[114676/122688  6]
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][[57332/57340  1]9C MQTT: Transport error
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:10.068][114676/122688  6][57492/57500  1] MQTT: Disconnected
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:11.836][110580/121836  9][56344/57492  2] WIFI: Connected to iot, requesting IP...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:11.999][110580/122380  9][56344/57492  2] WIFI: Received IP address 192.168.1.100
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:13.114][110580/122540  9][56344/57492  2] MSGR: Loading L:/online.cmd
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:13.133][106484/115992  8][56344/57492  2] MSGR: jsonl={"page":0,"id":239,"obj":"msgbox","text":"%ip%","auto_close":20000}
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:13.177][110580/121436  8][56916/56924  1] MSGR: Loaded L:/online.cmd
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:13.187][110580/122040  9][56916/56924  1] HTTP: Started @ http://192.168.1.100
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:13.198][110580/122088  9][56916/56924  1] MDNS: Starting...
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:13.230][106484/114796  7][56916/56924  1] MDNS: Started
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:15.105][102388/114620 10][56076/56912  2] MQTT: Transport error
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:15.114][102388/114620 10][56076/56912  2] MQTT: Disconnected
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:15.397][102388/114620 10][56076/56912  2] MQTT: Not connected ??? p0b239 => {"event":"down","val":0,"text":"OK"}
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:15.577][102388/114620 10][56916/56924  1] MQTT: Not connected ??? p0b239 => {"event":"up","val":0,"text":"OK"}
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:20.176][102388/114640 10][57492/57500  1] MQTT: Transport error
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:20.185][102388/114640 10][57492/57500  1] MQTT: Disconnected
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:25.794][102388/114640 10][57492/57500  1] MQTT: Transport error
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:25.803][102388/114640 10][57492/57500  1] MQTT: Disconnected
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:31.463][102388/114640 10][57492/57500  1] MQTT: Transport error
[1B][1000D[1B][0KPrompt > [1B][1000D[1B][9C[14:45:31.472][102388/114640 10][57492/57500  1] MQTT: Disconnected

******** UPDATE (And interim solution) ********
In the MQTT configuration, I entered the IP of my broker, and now I am making progress. The example plate configuration is working.

If I ping marvin.local, I get 192.168.1.124
But if I use marvin in the MQTT server name, it won’t connect.
But, marvin.local does work.

Doh!

Where is this used??

Well use marvin.local.

the entity_id is used at the binary sensor (state + attribute) in step 7 in my case "automation.update_display_data"

- binary_sensor:
  - name: Display settings
    unique_id: 1b3a3dae-fd0c-4f47-9c8b-5b680478a977 # https://www.uuidgenerator.net/
    state: "{{ now() - state_attr(this.attributes.update_automation | default('automation.update_display_data'), 'last_triggered') > timedelta(seconds=this.attributes.update_time | default(120) |int ) }}" # change the default automation entity_id from step 3 before
    delay_on:
      seconds: 2
    attributes:
      update_automation: "automation.update_display_data"
      update_time: "80" # sending the config via mqtt needs some time to complete. This stops the automation from re-run before sending config is finished
      ...

The automation itself can be used to trigger at certain events if you you need this anyway. I had trouble with a single automation trigger like

- platform: event
  event_type: openhasp_plate_online
  event_data:
    plate: 3c8427c966b8
  id: restart_display

because updating all the mqtt topics take a while and the automation was constantly triggered, I decided to lock the automation from running by adding a condition that is only true, if the last run of the automation itself is at least 80 seconds (update_time: "80") ago.
But again If you don’t need automation at all you may skip these parts

condition: state
entity_id: binary_sensor.display_settings
state: "on"

Here is the trigger and condition part of my automation:

alias: Update Display data
description: ""
trigger:
  - platform: homeassistant
    event: start
    id: ha_restart
    enabled: true
  - platform: event
    event_type: openhasp_plate_online
    event_data:
      plate: 3c8427c966b8
    id: restart_display
  - platform: state
    entity_id:
      - media_player.kuche
    attribute: entity_picture
    id: new_coverart_kueche
    for:
      seconds: 1
    enabled: true
  - platform: state
    entity_id:
      - media_player.bad
    attribute: entity_picture
    id: new_coverart_bad
    for:
      seconds: 1
    enabled: true
  - platform: state
    entity_id:
      - weather.home
    id: new_weather_condition
  - platform: time_pattern
    id: testing
    enabled: false
    minutes: /30
conditions:
  - condition: trigger
    id:
      - restart_display
      - new_weather_condition
      - new_coverart_kueche
      - ha_restart
      - new_coverart_bad
      - testing
  - condition: state
    entity_id: binary_sensor.display_settings
    state: "on"
action:
...

Thanks. I am not at the stage of using automations yet. I am still struggling with making buttons do something. My example is working, so far…

i am new to this.please guide pin location to flash openhasp firmware.is the location i showed correct.and i can’t find gpio0.please guide

I have no idea if I understand correctly, but I used a USB connector to flash fw openhasp.

I still don’t grok. Should this empty automation be named “update_display_data”?

where is the location of the jason file, I tried using /config/openhasp/pages.jsonl, but the path to a JSONL file is invalid, I encountered this when setting up your OpenHASP Plate. Please help

You may name it as you like, as long as you change it in the binary sensor
state and update_automation

- binary_sensor:
  - name: Display settings
    ...
    state: "{{ now() - state_attr(this.attributes.update_automation | default('automation.update_display_data'), 'last_triggered') > timedelta(seconds=this.attributes.update_time | default(120) |int ) }}" # change the default automation entity_id from step 3 before
    ...
    attributes:
      update_automation: "automation.update_display_data"

If you copied this

[
    "SEITE 0 - SETTINGS",
    {
        "page": 1,
        "id": 0,
        "prev": 4
    },
    "SEITE 0 - PREVIOUS -BUTTON",
    {
        "page": 0,
        "id": 1,
        "obj": "btn",
        "outline_opa": 0,
        "border_opa": 0,
        "text_font": 32,
        "toggle": false,
        "action": "prev"
    },
    "SEITE 0 - HOME - BUTTON",
    {
        "page": 0,
        "id": 2,
        "obj": "btn",
        "outline_opa": 0,
        "border_opa": 0,
        "text_font": 32,
        "toggle": false,
        "action": {
            "down": "back",
            "hold": "restart"
        }
    },
    "SEITE 0 - NEXT - BUTTON",
    {
        "page": 0,
        "id": 3,
        "obj": "btn",
        "text": "\uE054",
        "outline_opa": 0,
        "border_opa": 0,
        "text_font": 32,
        "action": "next",
        "toggle": false
    },
    "SEITE 1 - CONTAINER",
    {
        "page": 1,
        "id": 2,
        "obj": "obj",
        "border_opa": 0,
        "bg_opa": 0,
        "click": 0
    }
]

from my very first post than it is a json file not jsonl
Also make sure the file exists in your homeassistant config filesystem.
Also from the openhasp documentation

The file must be located in an authorized location defined by allowlist_external_dirs (in case of hassio /config/ is the directory where Home Assistant’s configuration.yaml resides, so in case of a subdirectory called openhasp the full path would be e.g. /config/openhasp/pages.jsonl json, and you need to add /config/openhasp/ to your allowlist_external_dirs).

For example, to allow read-access to the folder, add these lines to your configuration.yaml :

homeassistant:
  allowlist_external_dirs:
    - "/config/openhasp"

I tried using the toggle switch, but when the toggle switch was on, it couldn’t turn on the light, here is the data.
yaml.config

  • obj: “p1b3” #
    properties:
    “val”: ‘{{ 1 if states(“switch1”) == “on” else 0 }}’
    “text”: ‘{{ “\uE6E8” if is_state(“switch1”, “on”) else “\uE335” | e }}’
    event:
    “up”:
    - service: homeassistant.toggle
    entity_id: “switch1”

json:
{“page”:1,“id”:4,“obj”:“switch”,“x”:200,“y”:145,“w”:105,“h”:55,“radius”:15}.
how to fix it.thank you