|
楼主 |
发表于 2020-6-25 12:34:33
|
显示全部楼层
- esphome:. a3 u2 l) ^& s8 v& c
- name: dsm* S% ~. H$ h* H
- platform: ESP8266
, G6 d- p n3 a+ n1 E" n% r - board: nodemcuv2
8 M6 K& N0 N. M3 T4 I2 Z - 2 n6 V; G. f0 h! A* R h
- wifi:
* Q0 Z0 f& X" c1 b0 s; Y( t - ssid: "xxxxxxxxxx"
) t# F1 e. n7 w- j& ?8 X - password: "xxxxxxxxxxx"
+ q* j/ B D5 O
- A9 b7 I. c3 `- # Enable fallback hotspot (captive portal) in case wifi connection fails
& W! o, u* M" A/ D - ap:$ N" A) i2 I7 p! Y. S
- ssid: "nas66.com" s8 a9 }9 v9 n s4 O; A; P1 q
- password: "nas66.com"
6 C9 d! r% }# ]* ~# `( D4 a1 a - # t$ D; D* b! }5 |
- captive_portal:
: H& H4 Q! k6 \ - 7 c$ a" o; L4 \- T
- # Enable logging& e8 G% ?2 j. z1 j2 P% [
- logger:) O/ Z; u9 p# o1 B/ c, g! r2 i
- + i0 W f' ~* @% q6 A: |4 k% G
- # Enable Home Assistant API
7 w- Q g7 J. h: o2 b. s - api:
0 {4 Q8 |* g2 Q& z" F7 x+ @' J4 {9 H$ G
5 c. X7 ]6 K/ \3 G2 x! e. W, L% U- i2c:* z& n# o9 H y) G' O
- sda: D2
& s) w# B, b. O6 F" U7 s Z - scl: D4
8 m I$ ?/ m; O* h L$ J+ p
! p& G8 w' d4 `5 s( z8 @- image:- F' W5 q1 i( @! l. C" o
- - file: "logo.png"% j1 f% E! i$ }6 o+ ]/ k3 @
- id: my_image5 i* P9 H/ a5 y5 F# w( X: _3 ^% u0 @
- resize: 128x647 N. K, H$ u8 s8 p: [
- t i' J2 s5 U$ h- o$ x
- time:
- Z& J& @. V3 A5 c( k - - platform: sntp
. y; u3 ~- o( b( K: y: B7 e - id: sntp_time; _% u" o# ?6 h
- timezone: Asia/Shanghai
0 S+ T9 V; u1 m" s5 G' N J - 4 N S, J/ c' ?; o' E4 i5 l$ {7 K
- display:& W6 w9 n$ J$ y/ J
- - platform: ssd1306_i2c0 x1 P! H5 f; R) `& I: ?- i5 }
- model: "SSD1306 128x64"
3 f- Z' O D8 G. Z$ W - id: "ssd1306"
# n8 R3 g4 w" U. Q' _5 Y5 t - reset_pin: D0: A" \( s7 Z6 D" R+ f
- address: 0x3C4 y. C) ^) `, J) Q# _! F
- rotation: 180
7 L3 D3 W" z! s! i; Z: b5 ]( E5 k - brightness: 30%
% ?. A: d7 K- p( k
" K. F( n5 P2 I. b- pages:- n) R' Y; b1 [& L7 s6 D$ Q
- # - id: page1
6 \6 C/ o3 j# H3 |0 S; J - # lambda: |-
6 A" o0 c) e3 W - # it.printf(0, 30, id(font3), "S:%s", id(sec).state ? "ON" : "OFF");; Q$ _% g! o5 d
S* }9 N0 [8 q4 v+ Q- - id: page1
* M, i! O$ ^# I1 \, Q - lambda: |-
, }# v$ d' i9 }5 B - it.print(47, 0, id(font2), "Info");9 k* I/ z9 a1 N$ K1 \" }; A3 c
- it.line(0, 22, 128, 22);1 n) N9 D$ \; \. a2 f2 X
- it.line(0, 23, 128, 23);
$ V% M0 R3 d7 J3 G6 N+ F - it.line(0, 24, 128, 24);
7 f/ T: ]$ L3 I. t; c" s+ } - it.printf(0, 35, id(font1), "CPU: %.0f%%", id(cpu).state);' d0 A! O( J8 G
! Q: W; I, w0 d% B9 ^- it.printf(0, 55, id(font1), "MEM:%.0f %/%.0fMB", id(memoryused).state,id(memorytotal).state);) ]$ `. V" ]$ Y& C5 z- `
- + ^9 I" F' g2 {
- # it.rectangle(0, 0, 128, 64);
3 Y: J/ H* ~) ]8 U3 c" e# j - - id: page2
( g8 r+ ^9 E# R& @( P& ?- I - lambda: |-( a6 N1 X5 C( X$ \9 v3 w
- it.print(0, 0, id(font2), "Network Speed");
8 S/ U$ x9 Z9 j/ }. q) }9 M - it.line(0, 22, 128, 22);) ~" s. ~8 N- _& Q. V; f+ z. z
- it.line(0, 23, 128, 23);8 O1 y* t x/ ^( V1 Q
- it.line(0, 24, 128, 24);) H# H. x3 Y8 X/ w/ j$ g
- it.printf(0, 35, id(font1), "U: %.0f Kbps", id(up).state);
! n9 Q+ b7 |, ?. L0 D8 W% j4 M - it.printf(0, 55, id(font1), "D: %.0f Kbps", id(down).state);
/ H2 c" V# h9 w" K; l c+ N2 [: G - - id: page3
: N! f& @8 G: H1 p - lambda: |-$ b4 t, ]5 D; T. ]( S# i4 V0 T+ Y
- it.print(24, 0, id(font2), "Disk State ");
- g) e6 o3 C% G, I - it.line(0, 22, 128, 22);
* c0 u! p' D3 c5 r/ n% r - it.line(0, 23, 128, 23);2 T5 B7 e8 r J* c9 [
- it.line(0, 24, 128, 24);- |! _' e+ W# c: E) ^$ _2 M( ?
- it.printf(0, 35, id(font1), "Use:%s%/%s", id(sdausage).state.c_str(),id(sdatotal).state.c_str());
4 D; u8 |* _/ b5 f @4 E - it.printf(0, 55, id(font1), "Temp: %.0f °C", id(sdatemp).state);( I9 a. h$ F: C& _5 k& p- w: B" u
- ; a5 _" i) G) ^8 }, I/ ~8 k! u$ S
- # - id: page3
V5 V( O/ `/ `' A7 L - # lambda: |-9 ] T& t- w# {# L3 _
- # it.print(0, 10, id(font3), "WOW!!!");5 M" }( r7 x: s2 u2 I z: k
- # - id: page4' g% p K) ?8 a* ~+ y# `
- # lambda: |-
% m; \) E/ g+ {) y, ] - # it.print(0, 10, id(font3), "Fantastic!!");
- x; F0 z6 o; r: N; v - # - id: page5
. P* p7 V6 Q1 G: \: ~6 b- L H$ L - # lambda: |-6 K8 k5 b1 L ~) C A" T2 `4 j' j
- # it.image(0, 0, id(my_image));
7 i4 e) Q! E) _: r2 H3 A - - id: showtime
7 ]1 q/ Q: J [- G6 e3 G - lambda: |-
- T. t1 W/ w; P8 a - it.print(40, 0, id(font2), "Clock");4 b: Y* P$ W: Y! u/ ?$ v& Y3 r
- it.line(0, 22, 128, 22);
! `3 T4 O- c* u$ k# d3 n( R - it.line(0, 23, 128, 23);$ q" Y6 x Y& W$ o4 c) z7 {: Y
- it.line(0, 24, 128, 24);3 f6 H8 M) r! f/ M5 Y% z
- it.strftime(15, 42, id(font3), "%H:%M:%S", id(sntp_time).now());% K- ~: O0 u* `$ n
- it.strftime(25, 26, id(font1), "%Y-%m-%d", id(sntp_time).now());
6 ]5 P4 a( \; v* T - & ], s n7 s, |4 F, D/ @
2 I, B) U" H! W; G3 ^$ t- ota:
; d8 ^3 e( \& C7 ~9 H6 x( w
% K4 ]( E; i* y- sensor:; T' p8 J. ?: m! B9 M u/ R
- - platform: homeassistant
1 X6 L9 y7 H8 K/ x" M$ t. S - name: "dsm load"6 Z. W9 d7 s0 o6 l- T( p
- id: "cpu"
/ N$ T2 g8 D( [' g F7 g7 A - entity_id: sensor.synology_dsm_cpu_load_total
$ g( V8 ~6 L! `$ e3 I/ f - " ~6 a' t0 C2 @
- - platform: homeassistant) R5 o, i( `# n
- name: "dsm down"1 K. p# Q, l. F! A
- id: "down"# A7 q m3 g( @0 E. E- v) X! {0 n
- entity_id: sensor.synology_dsm_network_down, t S& m! T, e" F' e1 v
% ~ a5 o1 `* k6 W- `' ?- - platform: homeassistant' W1 W$ ~ ^ A7 x
- name: "dsm up"
( B0 E h4 @( n' m$ B) ^ - id: "up"
( o8 ~* f7 {1 \ - entity_id: sensor.synology_dsm_network_up) H+ `% _+ p; I
, Z9 G# q \, e! H- - platform: homeassistant* @2 |( t2 W7 d2 \: g/ `* F
- name: "memory total"
& ?- W$ }3 _# a7 O& t: h; ~ - id: "memorytotal"$ t% |& B w. a- Z; [' U
- entity_id: sensor.synology_dsm_memory_size
7 L9 A! n" P8 v7 {2 f0 q
6 i z% X' s$ l5 J7 W- }4 U- - platform: homeassistant
4 u1 G/ q0 c4 ?- ~7 l - name: "memory usage"
, J. H2 f) f0 I - id: "memoryavailable"- o& C, n6 [; |& O9 U& p3 T5 U
- entity_id: sensor.synology_dsm_memory_available_real
3 k7 i; G6 P( i4 J7 V1 P - 9 U N- P/ K, I
- - platform: homeassistant
$ X3 L2 R2 H! |4 k - name: "memory usage"7 i3 F$ ]* h. a/ \8 G; F
- id: "memoryusage"
5 L8 d# u1 S p9 f( t0 W+ ~ - entity_id: sensor.synology_dsm_memory_usage_real: y2 O! i- s9 a" z6 i, L
' t8 B& l/ S) i; ~" w& [6 s& B- % f4 T( r2 t0 S+ I# O2 u+ V2 t
- - name: "memoryused"+ H. T3 Q/ i& s z8 f. j
- id: "memoryused"
l* z/ x; ^! i - platform: "template"
6 T( G5 t0 `! b- Z/ r" D& Z8 T - lambda: |-' H. b& [* p1 n: u9 E$ ?
- return id(memorytotal).state - id(memoryusage).state/100*id(memorytotal).state ;
3 i8 t# t1 }2 Z$ U' G7 L - update_interval: 30s
. D& J: }3 e$ C. s6 d1 ^; @ - # C$ D. a2 {6 t- }
- - platform: homeassistant
8 y% F& t3 k* g) t. q - name: "sdatemperature"
0 R! }8 y$ ?2 R: R s+ o - id: "sdatemp"
- B6 E0 y: [0 @ - entity_id: sensor.synology_dsm_temperature_sda 4 n; E9 w4 i4 y4 E% m9 i
- , \) {9 ^' I9 n1 I# N9 t" D- ^( @1 p, e
- : [( P D: ?; r
- text_sensor:( p3 \# d% o4 B; s: a& z* k
- - platform: homeassistant
7 Y5 s m' q$ w, v6 Z - name: "sda total"
+ w$ s9 d$ M8 K! m: }+ B - id: "sdatotal"' h$ T. r X- x& m4 A
- entity_id: sensor.synology_dsm_total_size_volume_1
0 k! _6 n; Y; |" }5 b+ A0 z - - platform: homeassistant
7 }! I) `1 b& n- {" F - name: "sda usage"
4 R8 T' A! G# [& } - id: "sdausage"% B, Q5 c2 E0 [! c7 V
- entity_id: sensor.synology_dsm_used_space_volume_1
. ?3 _6 g/ _* ^. u - , H4 d# G0 z* ~5 N7 ?+ ?
- binary_sensor:" `& f% G3 D% r( K4 Q# n0 r
- - platform: homeassistant
( I, z6 @9 C- d( w - name: "sec"7 `. m4 \' Y% a
- id: "sec"7 k! B+ n2 o1 V0 M+ K0 k5 b* ]( Z
- entity_id: input_boolean.sec_office5 c$ F. q5 f/ z$ \- }' S- [% }
- . h5 p" r# p+ `/ K! Y$ V
- interval:
+ Q) N4 j6 N9 X% V - - interval: 10s0 t9 l$ y p, o% f5 O' l
- then:8 ~! M9 ?% ] {+ s; ^2 }( A4 a
- - display.page.show_next: ssd1306) J; s+ c7 |4 G. X
- #- component.update: my_display
0 I+ w7 [% U. {) H8 M - font:% Q& i, q% t9 s4 `9 T$ w
- - file: 'arial.ttf'/ a/ g7 j4 k1 ]# G' O! D- a
- id: font1
! j8 N9 M* p$ l - size: 15( J. F0 ]4 m2 q
- glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"! }1 f* O% n% o1 T
- - file: 'arial.ttf'
+ H/ l x1 M6 y' m( ~, ]& s - id: font2
/ ?2 N$ J2 u; N9 s' u8 F9 A - size: 18
8 q6 Z9 ]3 U' M2 s% r- [7 k6 ^ - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
* T" r. D. y& ~. C
. v. c& U5 |: F- Q: l- s9 I- 4 O, T9 G6 I, k$ ]4 H, s5 n. ?
- - file: 'arial.ttf'
# ?! U* R( {3 a" o0 s0 ]( s - id: font3
! c0 G% A4 G7 r, R( T - size: 23
# U- X' v0 A. M0 ?# P - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
复制代码 以上是dsm源码 你稍微阅读一下即可跟着编辑; c6 `5 E2 u$ V& s) P0 h
5 g7 Q, {* h2 V( E0 n0 L( A
5 `/ B' r# N- y |
|