|
楼主 |
发表于 2020-6-25 12:34:33
|
显示全部楼层
- esphome:4 w/ O& h7 B2 N0 Y
- name: dsm$ X4 h; S3 |( y
- platform: ESP82660 P1 A5 @) m% \/ u T1 B$ P+ u
- board: nodemcuv2
: |$ o% o* N' s' k& a
9 P: l& U' y) m1 O" z3 { t t- h8 r/ a- wifi:0 R2 U+ p+ u4 W% Q) x( N
- ssid: "xxxxxxxxxx"- T3 y& ~; C' Q3 }2 G
- password: "xxxxxxxxxxx"
7 i3 c; z! f- ~ - 3 o _' _+ B1 r5 Z& k& H% ^4 w
- # Enable fallback hotspot (captive portal) in case wifi connection fails/ ?$ }$ i' ^& I
- ap:% v, ]+ ] Q: K- |+ t( Y9 l
- ssid: "nas66.com"
/ ~ | @# o9 M - password: "nas66.com"
/ f( V6 P) n: G+ Y, I$ V9 S
4 v! P' R3 p4 l" t! v- captive_portal:
. z( A6 @& U0 X" i" A( p: z
8 F* {3 k* ]2 H7 ~& ]- # Enable logging
7 T% |6 k4 I) Z1 j' \- Y( L - logger:
- J+ A2 B5 S! Q' a, Z% j - N$ w0 m; D% n/ w/ ~
- # Enable Home Assistant API7 {3 W0 `( l6 I( c" M
- api:) O- `7 T; _/ i3 i9 F
% V. [; I* \3 ^0 g `- i2c:
* d1 _5 C. \1 X D: i - sda: D2% s5 ^$ a" n+ s# E" y3 o) }4 ]0 C5 d
- scl: D4
4 F0 f# ^9 o3 B# v9 {7 Y
/ w, R. L. O$ m/ h7 W- t& d7 z- image:1 L" p) ~$ E: h+ E
- - file: "logo.png"
: b0 o t/ G1 i) v - id: my_image
( O, }+ F4 R: s' U. R+ H, l3 ~+ Q - resize: 128x64" b6 S/ ?/ } ^6 Z
$ y1 L9 Y5 g0 I& E8 |- time:
7 m- A! [/ ^1 M1 k" a& B) W( l - - platform: sntp3 y1 P b1 k6 Q* M7 V8 m% F( l( D
- id: sntp_time: p. [- |9 x) n; v/ B
- timezone: Asia/Shanghai, D; E7 y% o: X3 q/ W3 y6 `
% f2 D. }0 I/ Q' ^- display:* O& n# E w3 t, l
- - platform: ssd1306_i2c
1 ^* ]% N; a$ w% C5 q - model: "SSD1306 128x64". l( Z3 d, ]. h5 b
- id: "ssd1306"
: g: l) h, g6 i% ~9 J; @/ g) f# b - reset_pin: D06 q3 D+ T& f9 [. @
- address: 0x3C: [- W+ v& e- G* P7 c. U' {1 f+ [) Q2 U
- rotation: 180$ j& I2 N* P. U1 y4 y. t- _
- brightness: 30%, v3 y1 {6 k) ^% |* E5 I( b4 N5 g
' {! Y" {5 z8 w. X4 H7 m- pages:# n( ^3 u8 I+ x5 v; P4 Q
- # - id: page1
H8 L3 S* P2 k. u Q# s - # lambda: |-9 r3 E: P* l& N8 ]- O. V1 U8 `/ w
- # it.printf(0, 30, id(font3), "S:%s", id(sec).state ? "ON" : "OFF");
% U$ q. e2 P/ p( V; o' F- e( ]' B - % r7 D1 K% }" }0 c P, n
- - id: page1
! b7 _& k Y* ^! S: C - lambda: |-
/ G. y: }# V1 u4 L) p, z - it.print(47, 0, id(font2), "Info");* k6 j6 O' m+ F# O* n3 e
- it.line(0, 22, 128, 22);" Q" ]/ s6 z, p" ^. f! D# w( H/ N
- it.line(0, 23, 128, 23);& p3 \+ b! T+ ?7 `
- it.line(0, 24, 128, 24);
/ T, V( U" J- e# b. C5 b - it.printf(0, 35, id(font1), "CPU: %.0f%%", id(cpu).state);
) Z0 Q4 n4 Y: x" ]; _8 W* C) {% G - % T( u2 g$ `& V4 }5 n; p
- it.printf(0, 55, id(font1), "MEM:%.0f %/%.0fMB", id(memoryused).state,id(memorytotal).state);4 k, Z, N( {5 H4 [& s- Y5 I
- 7 K, p1 C4 U, U- V( m
- # it.rectangle(0, 0, 128, 64);
1 f+ | W; _ D8 ^ - - id: page28 d% y6 A8 b/ V% A. X# ~
- lambda: |-
4 `2 f; P* `, c( h - it.print(0, 0, id(font2), "Network Speed");' g- [" w& A/ P
- it.line(0, 22, 128, 22);0 O+ J2 F8 f6 I8 W _; e
- it.line(0, 23, 128, 23);
5 I( b1 R4 A5 [5 e4 Y/ @ - it.line(0, 24, 128, 24);
, z1 O9 f) i3 e) \+ Z) K9 p2 c - it.printf(0, 35, id(font1), "U: %.0f Kbps", id(up).state);/ H$ n# V4 M7 C& `
- it.printf(0, 55, id(font1), "D: %.0f Kbps", id(down).state);
, Z) @! G3 r6 J3 h3 [5 I9 n - - id: page38 W# d* B/ O& O2 J* R
- lambda: |-$ l: z4 L1 j1 r
- it.print(24, 0, id(font2), "Disk State ");4 e) q0 d( S' K& y& S
- it.line(0, 22, 128, 22);
- z* m' j4 {! |0 `/ h4 D# ]' l - it.line(0, 23, 128, 23);; d' J6 k( \' S" s
- it.line(0, 24, 128, 24);: W! D, t* F/ D5 I
- it.printf(0, 35, id(font1), "Use:%s%/%s", id(sdausage).state.c_str(),id(sdatotal).state.c_str());
3 |) Y2 w U% W: a - it.printf(0, 55, id(font1), "Temp: %.0f °C", id(sdatemp).state);
! C6 {! H8 n$ z4 s+ j% D4 L$ H - % d& P4 H5 l8 r0 h+ Z; f: i
- # - id: page3
: Z! i# m) d/ L2 w - # lambda: |-
& p/ J1 o. f; l" F z$ ]0 O6 e - # it.print(0, 10, id(font3), "WOW!!!");
& r: {) R' O9 J, B% a" j - # - id: page4
3 t8 ^4 u+ }8 d - # lambda: |-
" q" K$ w- P' l8 k& ]$ X( ~. I - # it.print(0, 10, id(font3), "Fantastic!!");) V+ T0 h2 W/ B" F" k3 { ]
- # - id: page5
" K" P- ^! n1 q% Q+ u* S d - # lambda: |-
1 {7 T. Y9 }3 i/ E$ G& u - # it.image(0, 0, id(my_image));$ [5 {/ J* T" V; F3 z& p( F
- - id: showtime
* p. j6 c' I2 x* C1 T" } - lambda: |-7 r5 }* `0 S7 u. g
- it.print(40, 0, id(font2), "Clock");
, \0 Q9 `# Q; ?) w$ H3 \$ D - it.line(0, 22, 128, 22);
. U! _: D0 z. R" _4 u - it.line(0, 23, 128, 23);+ j1 c" P& `9 G
- it.line(0, 24, 128, 24);, u O0 f6 M, n5 n: c+ g: q
- it.strftime(15, 42, id(font3), "%H:%M:%S", id(sntp_time).now());; C0 g9 X( c0 R: i. \. c+ A
- it.strftime(25, 26, id(font1), "%Y-%m-%d", id(sntp_time).now());
) t; Q7 ^; n) W- Y5 N, } - ( d0 P; D8 X) e; ^6 R' o
- # S" c1 s6 q6 O+ t$ g* K' {& z
- ota:# h/ M5 U+ j9 D3 K- ]# _
- , n3 D. I+ J5 w; T1 R% z
- sensor:
; ?2 C( T, d( {2 Z7 y) c2 j$ I/ T8 B - - platform: homeassistant
3 v2 G! z# Z. F z2 i" m! G" ? - name: "dsm load"
r* Y. b% s/ L" Y - id: "cpu"1 V7 p7 C7 _4 z' t0 o6 m6 j. |
- entity_id: sensor.synology_dsm_cpu_load_total. |9 I* I3 L. E* X3 S2 O! y
8 f( o2 [, Q: O' s% d- - platform: homeassistant7 F: N& O) B: u/ P9 f
- name: "dsm down"' r0 b1 ?8 u6 t
- id: "down"- J$ Q, z9 Q' \$ [. P( y2 ^0 K
- entity_id: sensor.synology_dsm_network_down: V. {( k4 w# ]: o
6 V; v% ?; \: S2 T2 {! Y- - platform: homeassistant; G, k* e/ x5 V& h D i! q
- name: "dsm up"
# K& z' ?2 ]9 g5 a - id: "up"
3 O7 C( n- R+ t2 H: n. w - entity_id: sensor.synology_dsm_network_up
: S: |4 D' b' r1 N/ D' c2 q( x
9 A% f! q2 N/ N* f# L- - platform: homeassistant$ e+ P, i% |) J5 a" e- a+ T
- name: "memory total"
M$ s5 @ N! Q% |& s" J/ k - id: "memorytotal"( w' G- V( \ F3 `* k4 q: b4 O
- entity_id: sensor.synology_dsm_memory_size- x6 ~- u' G, @/ E* c6 s
- 1 x r3 W$ z4 ?. [; ` R. A
- - platform: homeassistant
, T$ h0 v2 M% K* f - name: "memory usage"8 B# O8 T" |0 J* k
- id: "memoryavailable"
! `$ h+ S G6 w' P1 x+ r - entity_id: sensor.synology_dsm_memory_available_real
, p w- [2 |* a# D r. a
- i# s) i: O, D8 K- - platform: homeassistant
$ x8 a! x; g5 `6 A% ^0 S/ v, q - name: "memory usage"
, M+ ?& I- E- ? - id: "memoryusage"8 Z) G1 c( \" h' m" I
- entity_id: sensor.synology_dsm_memory_usage_real8 R( [5 J0 _: k0 s0 w6 F6 o- q& }
# V& ]9 |1 K' P5 h; C0 A) l4 t
2 m5 a6 ?/ Y6 Y4 ^- - name: "memoryused"
) Q% P9 P i' |% J8 v - id: "memoryused"+ k8 ?7 z: u0 o5 D' v6 M( K
- platform: "template"
! `( t" F R9 p - lambda: |-. k( a, C% L, g1 T, o
- return id(memorytotal).state - id(memoryusage).state/100*id(memorytotal).state ;
, p, I" j2 p# S: w. K - update_interval: 30s
" S+ e% i* r6 K2 _" Y - V2 h t6 {. H4 C. P
- - platform: homeassistant1 q# U9 C7 v0 V3 v) G2 D
- name: "sdatemperature", c/ `# Y* a& N1 b
- id: "sdatemp"
4 D0 y+ U' b: }5 @: I - entity_id: sensor.synology_dsm_temperature_sda
$ p- D G) T! W4 s - , g; t; a- b2 w3 T4 ~/ g+ |: V- D
: T! x9 r- o L3 K( S2 O6 \1 M- text_sensor:: m$ p9 P; Z2 q
- - platform: homeassistant
$ ?! u o* F+ H0 s1 v - name: "sda total"
# j/ K8 D6 V* i3 E' g" |7 T; P# H - id: "sdatotal") r$ W; c5 |2 Y8 t x" B' b- O
- entity_id: sensor.synology_dsm_total_size_volume_1% ~$ }9 a }8 y$ _/ o
- - platform: homeassistant& ~$ _( |! u4 S8 U S% }3 I- A4 x
- name: "sda usage"
( _% x1 ~& Z5 }1 G' Z: i- s - id: "sdausage"
) m( u: G4 G+ E$ X - entity_id: sensor.synology_dsm_used_space_volume_1
0 R. _; l; L) l/ j4 R6 P/ X, ~( c
2 g* e5 T+ N" \: Y& h- binary_sensor:
" |' E* b. y/ s/ G6 Z. O& `! _ - - platform: homeassistant
- W) G* \ [. }8 S5 M9 q- j, U - name: "sec"% Y2 {6 I* S/ _8 S2 w% I
- id: "sec"
' @* e5 @1 p7 N - entity_id: input_boolean.sec_office& |. W% w( o. O/ p% [& g# K- T2 i
- $ y! T; u$ f0 C8 H/ K
- interval:
% j. `$ y5 u- @, t# ^ - - interval: 10s+ t5 C; T$ D3 b- W/ O1 s
- then:
& F8 @' _7 h4 p* U S1 y; i5 b - - display.page.show_next: ssd13069 [# ]; a; x; A) }6 w* {
- #- component.update: my_display! M# E! ~! h3 K4 n; H% y0 {; p
- font:4 m6 ^, k9 x9 Q9 S2 {- ]
- - file: 'arial.ttf'8 K4 `4 `4 ~$ d* A, W2 u
- id: font1" }1 n7 b! x- L. }' H
- size: 15
* E7 s9 F+ U, G( W( c - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"8 V1 `6 s+ U0 z; B- f# s W
- - file: 'arial.ttf'
) J4 \& ~5 n6 B+ G L) c( w0 y - id: font2
& \7 \# L+ X! U9 d3 B( V$ F4 q - size: 183 q' z* C, ^* g' Z
- glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
# L9 r' H) c0 z; F& v5 Q; E - $ s$ K' U) ], W% j4 D$ P
- 1 z) a- R3 U, f
- - file: 'arial.ttf'
! v9 K' x9 d% q& U. ?& G' d* L - id: font3
6 e n. e7 v4 o0 O! H6 e - size: 23
+ j( t* k% ] ~9 b! v [- e/ M - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
复制代码 以上是dsm源码 你稍微阅读一下即可跟着编辑" ?: S1 E( b: N9 o8 M* ~0 v4 k
( v' r A% B3 w) A0 d% f7 x1 r
! m- X* K0 g6 ^8 o8 O0 H |
|