Interesting touch switch lanbon l8

Hi do you happen to have Tuya firmware saved? for 3gang EU version.
I would be highly appreciated.

Apologies in advance as I have cross posted this on Discord & on the Github page as well. hoping someone here is able to assist with my newbie question on Lanbon L8 before I consider flashing custom firmware to it.

I have one relay of the Lanbon L8 (3 gang version) physically connected to a lightning circuit in my theatre room. Before I consider flashing it with custom firmware, I wanted to know if the custom firmware makes it possible to use the Lanbon in a complete detached mode - i.e seperate the switch on the HASwitchPlate firmware from the relay itself. I have a number of Shelley’s in my house which provide this option.

I would like to then use HomeAssistatant to control the relays via MQTT and use the remaining switches to trigger other scenes in my theatre room. Would be good to know before I consider flashing as I’m unable to change the wiring of the relay to the lightning circuit myself as it is not legal for me to carry out electrical works without a license.

Yes you can. You should look at openhasp.

Good day, i finally got around flashing the L8-HD with 0.6.3 and cant get it to work.
It’s an EU version and i tried this pinout, as well as using group1 for pin12 per the docs
image

Any guidance is much appreciated

Follow these steps:

  • Set the Type to L8-HD (AU)
  • Reboot to save the new settings
  • Power off the Lanbon for at least 2 minutes
  • Try again

@fvanroie, thank you for your help.
I had to execute your instrucstions maybe 4 times and in the end it’s working. Whilst It’s an EU version, it only works with type to L8-HD (AU).

In the process of introducing the plate i think i stumbled upon a bug. You may recall you provided this bin with the mqtt restart fix; I’ve now installed on the other 24 plates I’ve got running and it’s working perfectly.

So I uploaded this same bin (full) on the dimmer plate (plate25) and no matter what i tried (restart the plate, restart HA, discovery command) the autodiscovery will not pick it up.
The only way to add it, was to install 0.6.3 and it immediately appeared.
See below plate picture.

dimmer

Thank you again.

1 Like

Has anyone been able to use homekit version directly in HA using homekit controller?

1 Like

I have a L8 happily running openHASP but now that there is a LVGL component in ESPHome, I would much prefer to have it natively integrated in HA rather than via openHASP.

Has anyone successfully configured ESPHome display and touchscreen components for the L8?

You can more than likely do it manually, but openhasp gives you all the logic and stuff you’ll need to implement yourself in esphome. Plus, you’ll need to create all your interfaces yourself.

You do realize that esphome is a Hass add-on, just like openhasp. So either way, you’re using a 3rd party add-on to add functionality to hass, be it esphome or openhasp.

ESPHome is owned by the HA folks so more likely to be kept in close sync IMO. Seeing that I have to manually re-flash to go from 0.6.0 to 0.7.0 rather than OTA is what is triggering this exploration. I’m running several other ESPHome devices and it would help minimize differences for ease of upgrades/maintenance.

I’ll report on my findings (if any).

2 Likes

OpenHASP is pretty tightly integrated with HA.

I got this far using the configuration parameters found on openHASP:

spi:
  clk_pin: GPIO19
  mosi_pin: GPIO23
  miso_pin: GPIO25

i2c:
  sda: GPIO4
  scl: GPIO0

output:
  - platform: ledc
    pin: GPIO26
    id: moodRed
  - platform: ledc
    pin: GPIO32
    id: moodGreen
  - platform: ledc
    pin: GPIO33
    id: moodBlue
  - platform: gpio
    pin: GPIO12
    id: relay_1
  - platform: gpio
    pin: GPIO14
    id: relay_2
  - platform: gpio
    pin: GPIO27
    id: relay_3

light:
  - platform: rgb
    name: "Mood Light"
    red: moodRed
    green: moodGreen
    blue: moodBlue

display:
  - id: langbon_L8
    platform: st7789v
    model: Custom
    height: 320
    width: 240
    offset_height: 0
    offset_width: 0
    backlight_pin: GPIO5
    cs_pin: GPIO22
    dc_pin: GPIO21
    reset_pin: GPIO18
    auto_clear_enabled: false
    update_interval: never

If I leave out the display element, the device works fine and I can control the RGB moodlight.

But with the display element, it won’t boot. I connected the IDF monitor (using a different IDF project of mine) and here’s what I see:

Rebooting...
[I][logger:171]: Log initialized
[C][safe_mode:079]: There have been 2 suspected unsuccessful boot attempts
[D][esp32.preferences:114]: Saving 1 preferences to flash...
[D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[D][spi:035]: Setting up SPI bus...
[I][i2c.arduino:218]: Performing I2C bus recovery
[C][light:021]: Setting up light 'Mood Light'...
[D][light:036]: 'Mood Light' Setting:
[D][light:041]:   Color mode: RGB
[D][light:085]:   Transition length: 1.0s
[C][st7789v:011]: Setting up SPI ST7789V...
[D][spi_device:362]: mode 0, data_rate 20000kHz
[E][display:017]: Could not allocate buffer for display!

I’ll file an issue agains ESPHome but I guess I’m sticking with openHASP!

Just a thought: Does the esp32 in that device offer psram and do you have it defined in your yaml?

Edit: The link in github claims your device has 8MB psram but the yaml you post with your issue does not contain the psram component!

Thank you that did it! Adding:

psram:
  mode: octal
  speed: 80MHz

And now the device boots fine (but looks like it only has 4MB):

[C][light:092]: Light 'Mood Light'
[C][light:094]:   Default Transition Length: 1.0s
[C][light:095]:   Gamma Correct: 2.80
[C][psram:020]: PSRAM:
[C][psram:021]:   Available: YES
[C][psram:024]:   Size: 4095 KB
[C][FT63X6:070]: FT63X6 Touchscreen:
[C][FT63X6:071]:   Address: 0x38
[C][FT63X6:074]:   Update Interval: 0.050s
[C][st7789v:124]: SPI ST7789V
[C][st7789v:124]:   Rotations: 0 °
[C][st7789v:124]:   Dimensions: 240px x 320px
[C][st7789v:125]:   Model: CUSTOM
[C][st7789v:126]:   Height: 320
[C][st7789v:127]:   Width: 240
[C][st7789v:128]:   Height Offset: 0
[C][st7789v:129]:   Width Offset: 0
[C][st7789v:130]:   8-bit color mode: NO
[C][st7789v:131]:   CS Pin: GPIO22
[C][st7789v:132]:   DC Pin: GPIO21
[C][st7789v:133]:   Reset Pin: GPIO18
[C][st7789v:134]:   B/L Pin: GPIO5
[C][st7789v:135]:   Update Interval: never
[C][st7789v:136]:   Data rate: 20MHz
[C][lvgl:086]: LVGL:
[C][lvgl:087]:   Display width/height: 240 x 320
[C][lvgl:088]:   Rotation: 0
[C][lvgl:089]:   Draw rounding: 2

I’m not seeing the default LVGL “Hello World!” but that’s progress already.

1 Like

Here the’s the boilerplate ESPHome YAML for LVGL to work in the L8:

Use the ili9xxx driver, not the st7789v.

Isn’t this what we are already doing?

display:
  - platform: ili9xxx
    model: ST7789V
  ...

Apparently not, according to your log:

I now have this working including using the relays:

(really should have cleaned it before I took the photo!)

spi:
  clk_pin: GPIO19  
  mosi_pin: GPIO23 
  miso_pin: GPIO25 

i2c:
  sda: GPIO4
  scl: GPIO0

display:
  - platform: ili9xxx
    model: ST7789V
    cs_pin: GPIO22
    dc_pin: GPIO21
    reset_pin: GPIO18
    invert_colors: false
    auto_clear_enabled: false
    update_interval: never
    show_test_card: true 
    id: disp
    rotation: 180

output:
  - platform: ledc
    pin: GPIO5
    id: backlight_pwm
  - platform: ledc
    id: mood_red
    pin: GPIO26
  - platform: ledc
    id: mood_green
    pin: GPIO32
  - platform: ledc
    id: mood_blue
    pin: GPIO33        

light:
  - platform: monochromatic
    output: backlight_pwm
    name: "Display Backlight"
    id: backlight
    restore_mode: ALWAYS_ON
  - platform: rgb
    name: "Moodlight"
    red: mood_red
    green: mood_green
    blue: mood_blue

touchscreen:
  platform: ft63x6
  id: touch
  display: disp
  calibration:
    x_min: 0
    y_min: 0
    x_max: 230
    y_max: 312

  on_touch:
    - lambda: |-
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
              touch.x,
              touch.y,
              touch.x_raw,
              touch.y_raw
              );
  on_release:
    - if:
        condition: lvgl.is_paused
        then:
          - logger.log: "LVGL resuming"
          - lvgl.resume:
          - lvgl.widget.redraw:
          - light.turn_on: backlight
lvgl:
  displays:
    - disp
  default_font: montserrat_24
  on_idle:
    timeout: !lambda "return (id(display_timeout).state * 1000);"
    then:
      - logger.log: "LVGL is idle"
      - light.turn_off: backlight
      - lvgl.pause:

#time: !lambda "return  id(homeassistant_time).now();"
  style_definitions:
    - id: header_footer
      bg_color: 0x2F8CD8
      bg_grad_color: 0x005782
      bg_grad_dir: VER
      bg_opa: COVER
      border_opa: TRANSP
      radius: 0
      pad_all: 0
      pad_row: 0
      pad_column: 0
      border_color: 0x0077b3
      text_color: 0xFFFFFF
      width: 100%
      height: 30
      text_font: montserrat_18
  pages:
    - id: main_page
      widgets:
        - obj:
            align: TOP_MID
            styles: header_footer
            widgets:
              - label:
                  text: "Lounge"
                  align: CENTER
                  text_align: CENTER
                  text_color: 0xFFFFFF  
                  id: head_label

        - buttonmatrix:
            x: 5
            y: 40
            width: 235
            height: 260
            items:
              pressed:
                bg_color: 0x0f1e2f
              bg_color: 0xa3e8ff
            id: matrix_id
            rows:
              - buttons:
                - id: light_btn
                  control:
                    checkable: true
                  text: 'Kitchen'
                  on_click:
                    - homeassistant.action:
                        action: light.toggle
                        data:
                          entity_id: light.kitchen_lights
                    - logger.log:
                        format: "Kitchen Button pressed"
              - buttons:
                - id: light2_btn
                  control:
                    checkable: true
                  text: 'Family'
                  on_click:
                    - homeassistant.action:
                        action: light.toggle
                        data:
                          entity_id: light.lounge_lights
                    - logger.log:
                        format: "Family Button pressed"
              - buttons:
                - id: aircon_btn
                  control:
                    checkable: true
                  text: 'Aircon'
                  on_click:
                    - homeassistant.action:
                        action: switch.toggle
                        data:
                          entity_id: switch.d828c9db07ff_ac_power_status
                    - logger.log:
                        format: "aircon button pressed"                      
              - buttons:
                - id: wall_btn
                  control:
                    checkable: true
                  text: 'Wall Light'
                  on_click:
                    - homeassistant.action:
                        action: switch.toggle
                        data:
                          entity_id: switch.esphome_web_5e1530_relay1
                    - logger.log:
                        format: "wall switch button pressed"    
switch:
  - platform: gpio
    pin: GPIO12
    name: relay1
    id: relay1
  - platform: gpio
    pin: GPIO14
    name: relay2
    id: relay2
  - platform: gpio
    pin: GPIO27
    name: relay3
    id: relay3


binary_sensor:
  - platform: homeassistant
    id: kitchen_light
    entity_id: light.kitchen_lights
    publish_initial_state: true
    on_state:
      then:
        lvgl.widget.update:
          id: light_btn
          state:
            checked: !lambda return x;
  - platform: homeassistant
    id: family_light
    entity_id: light.lounge_lights
    publish_initial_state: true
    on_state:
      then:
        lvgl.widget.update:
          id: light2_btn
          state:
            checked: !lambda return x;            
  - platform: homeassistant
    id: bedroom_aircon
    entity_id: switch.0200000b34c2_ac_power_status
    publish_initial_state: true
    on_state:
      then:
        lvgl.widget.update:
          id: aircon_btn
          state:
            checked: !lambda return x;            
  - platform: lvgl
    name: button2
    widget: light_btn
    publish_initial_state: true
  - platform: lvgl
    name: button4
    widget: aircon_btn
    publish_initial_state: true    
  - platform: lvgl
    name: button3
    widget: light2_btn
    publish_initial_state: true
  - platform: lvgl
    name: button4
    widget: wall_btn
    publish_initial_state: true    
  - platform: status
    name: Status sensor


number:
  - platform: template
    name: LVGL Screen timeout
    optimistic: true
    id: display_timeout
    unit_of_measurement: "s"
    initial_value: 45
    restore_value: true
    min_value: 10
    max_value: 180
    step: 5
    mode: box
2 Likes

See my detailed experience (and all the code) here: ESPHome LVGL vs openHASP

2 Likes