Skip to content

Instantly share code, notes, and snippets.

@disgone
Forked from tubalainen/displaylabb.yaml
Created February 3, 2022 06:55
Show Gist options
  • Select an option

  • Save disgone/a4bea965b1408e6445b38a5ca5a6bd24 to your computer and use it in GitHub Desktop.

Select an option

Save disgone/a4bea965b1408e6445b38a5ca5a6bd24 to your computer and use it in GitHub Desktop.

Revisions

  1. @tubalainen tubalainen revised this gist Jan 1, 2022. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions displaylabb.yaml
    Original file line number Diff line number Diff line change
    @@ -27,8 +27,6 @@ time:
    timezone: Europe/Stockholm
    servers: 192.168.21.10

    switch:

    binary_sensor:
    - platform: homeassistant
    name: "PIR Framtisdan"
  2. @tubalainen tubalainen created this gist Jan 1, 2022.
    236 changes: 236 additions & 0 deletions displaylabb.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,236 @@
    esphome:
    name: displaylabb
    platform: ESP8266
    board: d1_mini

    wifi:
    ssid: 'meh'
    password: 'bbeeeh'
    ap:
    ssid: "DisplabbFallback Hotspot"
    # password: "rCdopOHEnjsj"

    # Enable logging
    logger:

    # Enable Home Assistant API
    api:

    ota:

    web_server:
    port: 80

    time:
    - platform: sntp
    id: time_ntp
    timezone: Europe/Stockholm
    servers: 192.168.21.10

    switch:

    binary_sensor:
    - platform: homeassistant
    name: "PIR Framtisdan"
    internal: True
    entity_id: binary_sensor.shelly_19_switch
    id: pir_framsidan
    on_press:
    then:
    - display.page.show: rorelse
    - component.update: my_display
    - delay: 5s
    - display.page.show_next: my_display
    - component.update: my_display
    - platform: status
    name: "Displaylabb Status"
    - platform: gpio
    pin:
    number: D3
    inverted: True
    name: "Displaylabb knapp 1"
    filters:
    - delayed_on: 10ms
    - delayed_off: 10ms
    on_press:
    then:
    - homeassistant.service:
    service: input_boolean.turn_on
    data:
    entity_id: input_boolean.enable_rpisurv
    - homeassistant.service:
    service: light.turn_on
    data:
    entity_id: light.lampa_ikea_rgb
    color_name: 'goldenrod'
    on_release:
    then:
    - homeassistant.service:
    service: input_boolean.turn_off
    data:
    entity_id: input_boolean.enable_rpisurv
    - homeassistant.service:
    service: light.turn_on
    data:
    entity_id: light.lampa_ikea_rgb
    color_name: 'navajowhite'
    - homeassistant.service:
    service: automation.trigger
    data:
    entity_id: automation.rpisurv_overview
    sensor:
    - platform: wifi_signal
    name: "Displaylabb wifi signal"
    update_interval: 60s
    - platform: homeassistant
    id: office_temperature
    entity_id: sensor.kontoret_temperature
    internal: true
    - platform: homeassistant
    id: outside_temperature
    entity_id: sensor.auriolv2_4101_temp
    internal: true
    - platform: homeassistant
    id: rain
    entity_id: sensor.netatmo_regnmatare_sum_rain_24
    internal: true
    - platform: homeassistant
    id: octoprint_pct
    entity_id: sensor.octoprint_job_percentage
    internal: true

    text_sensor:
    - platform: homeassistant
    entity_id: alarm_control_panel.verisure_alarm
    name: "Alarm State"
    id: alarm_state
    internal: true
    - platform: homeassistant
    entity_id: device_tracker.life360_helena
    name: "Where is Mamman"
    id: mamman
    internal: true
    - platform: homeassistant
    entity_id: variable.last_motion
    name: "Last motion indoor"
    id: last_motion_indoor
    internal: true
    - platform: homeassistant
    entity_id: variable.last_motion_outdoor
    name: "Last motion outdoor"
    id: last_motion_outdoor
    internal: true
    - platform: homeassistant
    entity_id: sensor.verisure_larmstatus
    name: "Verisure Larmstatus"
    id: verisure_larmstatus
    internal: true
    on_value:
    then:
    - lambda: |-
    if (id(verisure_larmstatus).state == "Armed Home On") {
    id(my_display).set_contrast(0.1); }
    else {
    id(my_display).set_contrast(1.0); }
    font:
    - file: 'slkscr.ttf'
    id: font1
    size: 8
    glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé'

    - file: 'bebas-neue-regular.ttf'
    id: font2
    size: 48

    - file: 'arial.ttf'
    id: font3
    size: 14
    glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé'

    - file: 'bebas-neue-regular.ttf'
    id: font4
    size: 32

    - file: 'arial.ttf'
    id: font5
    size: 12
    glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé'

    - file: "arial.ttf"
    id: tnr2
    size: 40
    glyphs: '!"%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ abcdefghijklmnopqrstuvwxyzåäöé'
    - file: 'materialdesignicons-webfont.ttf'
    id: icon_font
    size: 65
    glyphs:
    - "\U000F0594" # mdi-weather-night
    - "\U000F0599" # mdi-weather-sunny
    - "\U000F009E" # mdi-bell-ring-bell
    - "\U000F0D91" # mdi-motion

    i2c:
    sda: D6
    scl: D7
    scan: True

    display:
    - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    id: "my_display"
    contrast: 80%
    address: 0x3C
    pages:
    - id: page1
    lambda: |-
    // Print "Sikvägen 11" in top center.
    // it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Sikvagen 11");
    it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Alarm State: %s", id(alarm_state).state.c_str());
    // printf("%s\n", someString.c_str());
    // Print time in HH:MM format
    it.strftime(0, 40, id(font4), TextAlign::BASELINE_LEFT, "%H:%M", id(time_ntp).now());
    // Print inside temperature (from homeassistant sensor)
    if (id(office_temperature).has_state()) {
    it.printf(127, 41, id(font3), TextAlign::BASELINE_RIGHT , "Kont %.1f°", id(office_temperature).state);
    }

    // Print outside temperature (from homeassistant sensor)
    if (id(outside_temperature).has_state()) {
    it.printf(127, 10, id(font3), TextAlign::TOP_RIGHT , "Out %.1f°", id(outside_temperature).state);
    }

    if (id(rain).has_state()) {
    it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT, "Regn %.1fmm", id(rain).state);
    }
    - id: page2
    lambda: |-
    //it.strftime(0, 40, id(font4), TextAlign::BASELINE_LEFT, "%H:%M", id(time_ntp).now());
    if (id(last_motion_indoor).has_state()) {
    it.printf(0, 10, id(font5), TextAlign::BASELINE_LEFT , "I: %s", id(last_motion_indoor).state.c_str());
    }
    if (id(last_motion_outdoor).has_state()) {
    it.printf(0, 25, id(font5), TextAlign::BASELINE_LEFT , "O: %s", id(last_motion_outdoor).state.c_str());
    }
    if (id(octoprint_pct).has_state()) {
    it.printf(0, 40, id(font5), TextAlign::BASELINE_LEFT , "3D-printer: %.1f%%", id(octoprint_pct).state);
    }
    if (id(mamman).has_state()) {
    it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT, "H: %s", id(mamman).state.c_str());
    }
    - id: rorelse
    lambda: |-
    it.print(64, 0, id(icon_font), TextAlign::TOP_CENTER, "\U000F0D91");
    interval:
    - interval: 11s
    then:
    - display.page.show: page1
    - component.update: my_display
    - delay: 5s
    - display.page.show: page2
    - component.update: my_display