Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- captive_portal:
- i2c:
- ## - id: bus_a
- ## sda: 0
- ## scl: 26
- ## scan: true
- - id: bus_b
- sda: 21
- scl: 22
- scan: true
- - id: bus_c
- sda: 32
- scl: 33
- scan: true
- axp192:
- id: axp
- address: 0x34
- i2c_id: bus_b
- update_interval: 60s
- binary_sensor:
- - platform: gpio
- pin:
- number: GPIO37
- inverted: True
- name: "M5 Button"
- #on_press:
- on_multi_click:
- # double click
- - timing:
- - ON for at most 1s
- - OFF for at most 1s
- - ON for at most 1s
- - OFF for at least 0.2s
- then:
- - homeassistant.service:
- service: media_player.media_next_track
- data:
- entity_id: media_player.spotify_matt_bruman
- # hold button
- - timing:
- - ON for 1s to 5s
- - OFF for at least 0.5s
- then:
- - homeassistant.service:
- service: light.toggle
- data:
- entity_id: light.office_lights
- # single click
- - timing:
- - ON for at most 1s
- - OFF for at least 0.5s
- then:
- - homeassistant.service:
- service: media_player.media_play_pause
- data:
- entity_id: media_player.spotify_matt_bruman
- - logger.log: "single click - play/pause"
- - platform: axp192
- axp192_id: axp
- type: charging
- id: axp_charger
- name: "Charger"
- - platform: homeassistant
- id: lock_status
- internal: true
- entity_id: input_boolean.locks
- ##binary sensor for condition - invert as the toggle is to DISABLE the fans thus loop
- - platform: status
- name: "Node Status"
- id: system_status
- - platform: gpio
- pin:
- number: GPIO39
- inverted: true
- name: Button B
- on_multi_click:
- # double click
- - timing:
- - ON for at most 1s
- - OFF for at most 1s
- - ON for at most 1s
- - OFF for at least 0.2s
- then:
- - homeassistant.service:
- service: lock.unlock
- data:
- entity_id: lock.side_door_lock_locked
- - delay: 30s
- - homeassistant.service:
- service: lock.lock
- data:
- entity_id: lock.side_door_lock_locked
- # hold button
- - timing:
- - ON for 3s to 5s
- - OFF for at least 0.5s
- then:
- - light.toggle: backlight
- # single click
- - timing:
- - ON for at most 2s
- - OFF for at least 0.5s
- then:
- - display.page.show_next: tft
- # internal LED
- light:
- - platform: monochromatic
- output: builtin_led
- name: Led
- id: led1
- # internal LED
- - platform: axp192
- id: backlight
- axp192_id: axp
- restore_mode: ALWAYS_ON
- name: "Backlight"
- output:
- - platform: ledc
- pin: GPIO10
- inverted: true
- id: builtin_led
- sensor:
- - platform: axp192
- axp192_id: axp
- id: batterylevel
- name: "Battery Level"
- - platform: wifi_signal
- name: WiFi Signal
- id: wifi_dbm
- - platform: uptime
- name: Uptime
- image:
- - file: "spotify.png"
- id: my_image
- resize: 75x75
- text_sensor:
- - platform: homeassistant
- name: "Spotify Title"
- id: spotify_title
- entity_id: media_player.spotify_
- attribute: media_title
- - platform: homeassistant
- name: "Spotify Artist"
- id: spotify_artist
- entity_id: media_player.spotify_
- attribute: media_artist
- - platform: homeassistant
- name: "Spotify State"
- id: spotify_state
- entity_id: media_player.spotify_
- - platform: homeassistant
- name: "Office"
- id: light_office
- entity_id: light.office_lights
- - platform: homeassistant
- name: "Locks"
- id: lock_locks
- entity_id: input_boolean.locks
- - platform: homeassistant
- name: "Windows"
- id: windows
- entity_id: binary_sensor.windows
- spi:
- clk_pin: GPIO13
- mosi_pin: GPIO15
- font:
- - file: "arial.ttf"
- id: font1
- size: 14
- glyphs:
- ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
- '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
- 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/']
- - file: "arial.ttf"
- id: font2
- size: 32
- glyphs:
- ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
- '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
- 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/']
- - file: "arial.ttf"
- id: font3
- size: 14
- glyphs:
- ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
- '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
- 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/']
- - file: "arial.ttf"
- id: font4
- size: 12
- glyphs:
- ['&', '@', '!', ',', '.', '"', '%', '(', ')', '+', '-', '_', ':', '°', '0',
- '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
- 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z', 'å', 'ä', 'ö', '/']
- color:
- - id: my_red
- red: 100%
- green: 0%
- blue: 0%
- - id: my_yellow
- red: 100%
- green: 100%
- blue: 0%
- - id: my_green
- red: 0%
- green: 100%
- blue: 0%
- - id: my_blue
- red: 0%
- green: 0%
- blue: 100%
- - id: my_gray
- red: 50%
- green: 50%
- blue: 50%
- #Display size 135*240
- display:
- - platform: st7789v
- id: tft
- update_interval: 1s
- cs_pin: GPIO5
- dc_pin: GPIO23
- reset_pin: GPIO18
- rotation: 0
- pages:
- - id: page1
- lambda: |-
- // Draw a line from [0,22] to [240,22]
- it.line(0, 22, it.get_width(), 22);
- //it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
- //it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar
- it.print(5, 5, id(font1), id(my_yellow), TextAlign::TOP_LEFT, "P1");
- it.printf( 100, 15, id(font4), TextAlign::CENTER, "Bat: %.1f%%", id(batterylevel).state);
- it.printf( 100, 5, id(font4), id(my_yellow), TextAlign::CENTER, "Wifi: %.1f%%", id(wifi_dbm).state);
- // Comment out the above lines to see the image without text overlaid
- // it.image(0, 0, id(my_image));
- it.printf( 5, 28, id(font1), "Windows: %s", id(windows).state.c_str());
- it.printf( 5, 38, id(font1), "Locks: %s", id(lock_locks).state.c_str());
- it.printf( 5, 58, id(font1), "Office: %s", id(light_office).state.c_str());
- - id: page2
- lambda: |-
- // Draw a line from [0,22] to [240,22]
- it.line(0, 22, it.get_width(), 22);
- //it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue));
- //it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar
- it.print(5, 5, id(font1), id(my_yellow), TextAlign::TOP_LEFT, "P2");
- it.printf( 100, 15, id(font4), TextAlign::CENTER, "Bat: %.1f%%", id(batterylevel).state);
- it.printf( 100, 5, id(font4), id(my_yellow), TextAlign::CENTER, "Wifi: %.1f%%", id(wifi_dbm).state);
- // Comment out the above lines to see the image without text overlaid
- // it.image(0, 0, id(my_image));
- - id: page3
- lambda: |-
- // Draw a line from [0,22] to [240,22]
- it.line(0, 22, it.get_width(), 22);
- it.image(30, 30, id(my_image));
- it.print(5, 5, id(font1), id(my_yellow), TextAlign::TOP_LEFT, "P3");
- it.printf( 100, 15, id(font4), TextAlign::CENTER, "Bat: %.1f%%", id(batterylevel).state);
- it.printf( 100, 5, id(font4), id(my_yellow), TextAlign::CENTER, "Wifi: %.1f%%", id(wifi_dbm).state);
- // Comment out the above lines to see the image without text overlaid
- // it.image(0, 0, id(my_image));
- //Spotify
- it.printf( 5, 130, id(font1), "%s", id(spotify_artist).state.c_str());
- it.printf( 5, 150, id(font1), "%s", id(spotify_title).state.c_str());
- it.printf( 5, 200, id(font2), "%s", id(spotify_state).state.c_str());
- time:
- - platform: homeassistant
- id: homeassistant_time
- - platform: sntp
- id: sntp_time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement