|
楼主 |
发表于 2020-6-25 12:34:33
|
显示全部楼层
- esphome: g8 p5 P0 |# Z8 F/ _! _& B: M
- name: dsm8 p7 q, W& g6 b7 p, M
- platform: ESP8266/ Q+ {3 D) j8 F5 f8 B0 X' |. H
- board: nodemcuv2
! L4 k! W; J/ | - * c6 v3 |2 h0 |% |3 _4 p% R
- wifi:
/ m! c6 p! S3 N$ R; ^( B. D4 V - ssid: "xxxxxxxxxx"
/ @3 o# |1 M% c - password: "xxxxxxxxxxx"% u+ W5 E; `1 R5 u
6 C3 B, W& C- B. N0 T- # Enable fallback hotspot (captive portal) in case wifi connection fails
1 N6 k) c" I$ W6 m! B; H$ I - ap:; J! [' \! p" |1 q5 {, O# D2 ^
- ssid: "nas66.com"
5 s* Q1 l e+ ^2 t* p5 y: p# T - password: "nas66.com"# l4 G* I" y* F
" g5 }$ B* M* u& c- captive_portal:
8 Y+ @1 ]9 h1 Q U0 H3 _. n [: P - " f {# @/ _& i1 O0 a# `
- # Enable logging0 U, o5 M1 U! B, \& I, `
- logger:' X$ ~( K5 @. {; Q$ ~" W
. }0 J! V* Q6 l) y( |4 e: W- # Enable Home Assistant API
, c& ]0 i5 a- ^0 U& U - api:
6 z2 m# {" ~% N5 o3 E
8 ~1 g; V8 U6 W- i2c:; i1 Y9 C0 \9 u& b* _2 m
- sda: D29 ?( x) M' Y6 w- ^' @# e
- scl: D4' X: }) a) {7 H( p6 I) A9 |
- 8 U; v; P/ {" U& `
- image:$ N1 G5 E/ p- i4 \ _0 \- j: K2 W8 v
- - file: "logo.png"
& _, D% K3 o/ u! f - id: my_image
8 ^3 |) o& G/ W4 r6 T9 R0 g# j - resize: 128x64
Z" C% M8 q: _9 X. j6 r9 ?
5 n3 Q: L% M0 j8 G' ?- time:
* N3 K6 a. `2 N0 V - - platform: sntp
* b$ g9 W1 O' [, B, Y - id: sntp_time
6 j! F' `* F; l: \8 j& l3 Z* [. D) g - timezone: Asia/Shanghai: j; k, N/ b, _8 f3 E# z( L
- , ~; B' x1 H5 o
- display:4 \- x. m# Y. p' X! z. O
- - platform: ssd1306_i2c
/ M" B% e% _4 z- u/ Q. c$ L2 f - model: "SSD1306 128x64"4 c! G7 q L& |+ r: Y* \# t: Z
- id: "ssd1306"
& E# A& I1 y4 k4 K C: T: u - reset_pin: D0
# f) f/ T9 O7 o/ s& f' ?* W - address: 0x3C
$ }& N5 @% o* v% G7 `' | - rotation: 180
: M- M3 V6 c: R, @& K- w - brightness: 30%
8 a; n: W# R8 V9 L: m7 W/ Z
/ f9 F6 }. u1 b; |- pages:
+ b g: J* m' A - # - id: page1" }) k Z3 ^1 w/ M
- # lambda: |-
" K8 u7 y3 {* |# }; y, d3 t - # it.printf(0, 30, id(font3), "S:%s", id(sec).state ? "ON" : "OFF");/ f) K- Y3 \6 o1 i7 f& F" o
6 O) [2 s' E& B; V* B- - id: page1
/ w. b; e0 w x ?! l: C0 K+ U& F - lambda: |-
3 S" x5 R s# z" J5 _3 i& J - it.print(47, 0, id(font2), "Info");
: V' }6 \$ M% d - it.line(0, 22, 128, 22);& b8 c& j6 g( U( p% b6 ^) U2 T
- it.line(0, 23, 128, 23);3 O" y* n) A' M. J' D& ?) q
- it.line(0, 24, 128, 24);
( s& Z7 a H' |* j - it.printf(0, 35, id(font1), "CPU: %.0f%%", id(cpu).state);+ y* z2 h" h0 b1 D7 t$ F
# C. R1 R" t+ n, |4 c- it.printf(0, 55, id(font1), "MEM:%.0f %/%.0fMB", id(memoryused).state,id(memorytotal).state);4 X, c$ g6 _- O6 ^+ D! Y
- 1 x* x" `! C# e; T6 m. s# Y8 h4 T1 K
- # it.rectangle(0, 0, 128, 64);- `5 w# w- ?: t6 U. T' t/ r6 o
- - id: page2
4 ]& Q6 s0 e5 Q( W+ E6 Y5 t, J8 _ - lambda: |-
~! u: }& Z! l2 G" a5 i+ i! ?7 Q* v - it.print(0, 0, id(font2), "Network Speed");
. W" Z/ t8 |) v/ I; p - it.line(0, 22, 128, 22);
; J9 {6 n, c e3 S& W - it.line(0, 23, 128, 23);* o# ?- I( v4 M- ~' O
- it.line(0, 24, 128, 24);
6 \4 f* r0 V; ^6 N, b - it.printf(0, 35, id(font1), "U: %.0f Kbps", id(up).state);0 E u& g0 J' `
- it.printf(0, 55, id(font1), "D: %.0f Kbps", id(down).state);. o& S5 a- {/ w- C! u* O2 \' x- h6 h
- - id: page3
- x, e( o. o$ R& y* U - lambda: |-: n4 k* `. E7 |. ?/ a# n2 N3 z
- it.print(24, 0, id(font2), "Disk State ");
& [4 h) V/ G8 C( i - it.line(0, 22, 128, 22);
6 r; c7 w, H. M" e- L( k4 Q - it.line(0, 23, 128, 23);
q+ x. m2 g5 _8 O. m - it.line(0, 24, 128, 24);
v: Q) |/ A. x2 g" W0 s1 A9 R - it.printf(0, 35, id(font1), "Use:%s%/%s", id(sdausage).state.c_str(),id(sdatotal).state.c_str());) [. [) |+ ^+ R/ B
- it.printf(0, 55, id(font1), "Temp: %.0f °C", id(sdatemp).state);" t" j+ s! [: o' d
& g7 o5 {1 I+ n# s- # - id: page3
- d: y9 c$ n) F - # lambda: |-+ ?- H, z/ u2 q- \1 s* {
- # it.print(0, 10, id(font3), "WOW!!!");0 S- o7 P( q6 V; D/ H3 ^1 N
- # - id: page4
' D) [, E: y- [$ s - # lambda: |-% W; n1 y M. w' `# @/ n
- # it.print(0, 10, id(font3), "Fantastic!!");
7 s5 |! D& a; b; y& U - # - id: page5( m% C. I7 x$ q9 \* Z
- # lambda: |-
1 d( g+ l1 t, | j: t6 R" B: y - # it.image(0, 0, id(my_image));
m, {6 K/ \: d/ h( M8 k - - id: showtime" T8 a: C& G1 X" F
- lambda: |-- N" g$ Z2 I) _ q
- it.print(40, 0, id(font2), "Clock");
! Y, W; M) E+ A1 a7 R - it.line(0, 22, 128, 22);
1 L, T% T& R0 n. P( T# v4 f2 K - it.line(0, 23, 128, 23);8 Y7 M/ J* B1 O9 r9 a. U
- it.line(0, 24, 128, 24);
* F& A' P% P3 ~5 r/ H3 o" c - it.strftime(15, 42, id(font3), "%H:%M:%S", id(sntp_time).now());$ w: Q. ~3 @. S$ ^: ?
- it.strftime(25, 26, id(font1), "%Y-%m-%d", id(sntp_time).now());
- F# ]% z: F/ `
+ ] V7 r, e; T/ y( i- 8 |0 ^7 G$ w& n3 ^2 k$ @
- ota:
% a& n, H0 [2 o2 a - 6 p8 J( m# |' p/ u0 G% u
- sensor:. [% ]' N4 o5 I$ ], s; a
- - platform: homeassistant
5 G( A) R+ Y; e; v3 t - name: "dsm load"6 c# O* \, w: c, {' a4 U2 D, h
- id: "cpu"7 }4 i* H7 o( j$ w& p* D' x
- entity_id: sensor.synology_dsm_cpu_load_total
7 ^5 A. [% ?" f6 G' Y- M0 x' Z; B, r - 8 f4 o: U$ y4 S. F) I
- - platform: homeassistant. `8 t L) w0 i( s) v7 @
- name: "dsm down"
6 R9 J1 [) M9 ?, k - id: "down"
. e" V; e& d, x8 t" b - entity_id: sensor.synology_dsm_network_down5 I0 g/ k$ ~/ I+ K( {, c1 P
- ( C P: l- ?: P. l9 d* b& c3 N
- - platform: homeassistant; T b8 \. e$ A+ m9 ?% v
- name: "dsm up"/ ~7 X8 Z c% h- P" F, B, \
- id: "up"
+ s" K1 s* }5 L c - entity_id: sensor.synology_dsm_network_up
6 M" V* c. S/ m7 V
) k1 f7 }! j5 h- r Z7 g1 ]- - platform: homeassistant
; w& o, k. S; a' h6 x8 h - name: "memory total"6 z4 _) i7 _8 |' W x! D
- id: "memorytotal"3 t' N; ?" I$ U* x
- entity_id: sensor.synology_dsm_memory_size
; g+ x' c' c* }, Y9 [, Y8 n - ) @. C7 M+ _# X; q) \5 m1 @! [
- - platform: homeassistant
Z) t& |' I' j4 C% _& m - name: "memory usage"" H! M+ t/ }4 _0 u" w: \0 K y% n
- id: "memoryavailable"
" L# U7 k2 S" [( v - entity_id: sensor.synology_dsm_memory_available_real
1 ?4 W0 `% Y& H/ H6 M x
& {7 K- i$ _+ H" b! t" R" A4 _! a- - platform: homeassistant
! D4 F9 R# h m - name: "memory usage" }# b3 E5 U+ e3 X& [, I7 j+ \/ b
- id: "memoryusage"# }) @- M5 \5 ^, X/ v* F. q) ?4 a: N
- entity_id: sensor.synology_dsm_memory_usage_real/ M# \0 Q/ Q3 I7 l0 X6 T
; g" \9 C' D$ F. }- / r+ D6 Q9 D7 I" }5 G
- - name: "memoryused"$ |) h2 |7 L1 T+ m7 x
- id: "memoryused"# ^" p2 p- {: C* i; M" w. p
- platform: "template"
! }6 U6 w. G# _& ^* M0 i% @/ t9 Q - lambda: |-- v/ c% r7 e2 R6 O: S1 a& V
- return id(memorytotal).state - id(memoryusage).state/100*id(memorytotal).state ;
0 A' k* Z6 \+ F7 H3 J4 C) O D - update_interval: 30s8 ~" `7 a+ D, y ~
. T# Y% [6 o; X- q7 I& P- - platform: homeassistant
9 B; `0 p1 E5 W1 N1 c - name: "sdatemperature"
. C5 d/ i0 P$ P3 x, _' n - id: "sdatemp"3 C) [9 e/ `% p7 b
- entity_id: sensor.synology_dsm_temperature_sda
- d& X" q# d. c2 V" e9 H
% q, H% ?3 _. X" [
: u9 W6 E0 D2 L% u |/ C% ]/ j- text_sensor:* u+ |. ~, z2 a. h3 \: i
- - platform: homeassistant" L. H! A: @4 s l
- name: "sda total"
+ C# O0 c$ o* m# }+ o- A$ B( r - id: "sdatotal"3 ?) F1 J9 o. ?* r/ C# Z7 I
- entity_id: sensor.synology_dsm_total_size_volume_1
0 E0 k6 h2 h3 x! o" B - - platform: homeassistant7 G4 `% ?" T: j2 X& i" k+ h
- name: "sda usage"9 w4 L$ m. G s- {
- id: "sdausage"
; Y8 y8 K0 ~. P- ~& i; w4 Y - entity_id: sensor.synology_dsm_used_space_volume_1
! I+ v) `! }1 T3 v# v( F$ P
7 K% I4 H$ R& k+ `+ ^. K- binary_sensor:: i! Z$ E; L _; }
- - platform: homeassistant
. r" V+ L( L# J2 ~ - name: "sec"
7 u2 b% i7 L: K% ^6 O) ?+ X - id: "sec"- Y$ r7 k8 Z, m0 I
- entity_id: input_boolean.sec_office% s8 {. Z K1 R3 H" Q, `$ K
# b( c" D0 ^7 |; H8 V- interval:) k; A: T; o0 ^$ }* j% D
- - interval: 10s) L i( c: e0 t- h; A7 P3 N) {4 Z
- then:' ?* _9 o- _8 b7 Y! E
- - display.page.show_next: ssd1306
$ ]6 }' m* r! C8 K/ `1 T - #- component.update: my_display5 s. [! k% I, A7 _7 F( [" O
- font:4 w# {9 z$ T( Y- F/ {# r! u7 I/ d! M
- - file: 'arial.ttf' Q/ M6 j/ X9 G3 m
- id: font11 k3 F: W B# b7 @+ `" n# }
- size: 15
- {1 \+ Z* ~' @ S, _7 s0 y$ ]( P3 c - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"& g8 u% Y6 X, i E2 f4 D" X
- - file: 'arial.ttf'( u$ t8 p4 i+ z3 I6 Q+ D6 V! O8 g
- id: font2 l% c/ y: m, ?+ Z! K$ B
- size: 18
$ ]6 \9 ~4 a7 K, O: q' r! u `1 h3 A - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
) b' ^0 M1 L' y5 \ - 5 l) O8 v7 p$ ?7 |1 f
- ]% `! i" O2 i; q& @4 S. X- - file: 'arial.ttf'0 V1 k% e% F; Y# O, i; e, {' F
- id: font3 t% e' H; ~1 D2 v9 b
- size: 23
" j+ c. }6 w5 T9 u+ k3 r& |. q& D - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
复制代码 以上是dsm源码 你稍微阅读一下即可跟着编辑
7 s) `1 |- q# f6 R/ A% Z3 ]: T+ A9 T7 ~3 }$ _+ M5 c' q
0 E9 Q- |9 ?0 F4 d4 }
|
|