|
|
楼主 |
jakc
发表于 2020-6-25 12:34:33
|
显示全部楼层
IP:–广东–揭阳 电信
- esphome:
; B1 e0 x. q: {7 R! N - name: dsm
! d1 m. w3 k- x1 k- z. { - platform: ESP8266; H' m6 s8 ~) g" ]3 `8 }3 q
- board: nodemcuv2
' g+ \ l1 P. A. Y$ Y - / t% t4 n6 E _7 a3 q. c3 X
- wifi:
% M9 q) m" X7 |& }% z* M1 z | - ssid: "xxxxxxxxxx"
9 ~% T; F5 M1 M( R2 _9 E6 E. Z4 x - password: "xxxxxxxxxxx"
5 t1 D/ ^# V3 f. y o6 ]& `
3 K D0 e8 J Q3 i5 u- # Enable fallback hotspot (captive portal) in case wifi connection fails5 W& u R7 W w) n* O5 w0 ~
- ap:: X7 V+ ? h' u
- ssid: "nas66.com"- M% a% G- H5 D
- password: "nas66.com"" N" V- y& Z+ ]- ]6 n" `7 ~
3 E9 m" \1 ^8 o. Z: a( p- captive_portal:
5 d2 }( m+ |0 \* {0 ]: p2 W
4 H! P* d0 G3 q0 f7 P# x- # Enable logging! g( Q) F1 S6 x1 ~5 U
- logger:
4 ^: U, ?" i/ l# @) `
$ l2 E' t4 ]9 b/ T3 c4 u- # Enable Home Assistant API3 W. |$ B7 L: |1 r0 G9 M0 k
- api:. X9 n# ?! O8 M6 ^ g
7 @6 b# f% `% _; F1 z; z- i2c:
' u( t. ?4 B2 C8 f- j! l4 Y - sda: D2
6 d0 G% A9 {2 s - scl: D4. P9 L$ C# H7 A k# _
- 5 v3 |$ K7 [3 z
- image:7 l3 u/ q8 j6 g+ Y# g) o4 Y
- - file: "logo.png"
+ r c% ~. ~( X - id: my_image6 H+ U, I/ i2 w. p
- resize: 128x64* l l) f- I T q, v
) D. }5 u8 B8 k! c: G- time:
1 X( L9 y8 r+ c' z0 z8 T6 F - - platform: sntp7 ^- ~1 N* z% S
- id: sntp_time
9 H, M# Z$ a3 W - timezone: Asia/Shanghai
, L: N9 u+ D8 o2 W3 {) X3 W - * B1 s3 l" c0 K/ U' V% V/ O
- display:
( I$ R8 z% T( E8 l0 _6 f - - platform: ssd1306_i2c2 g; ?* `& n6 A! y5 s4 \
- model: "SSD1306 128x64"
3 s1 k9 q8 g4 S6 R$ } - id: "ssd1306"# T- R# S* {. T( [4 Q+ g
- reset_pin: D0
2 d$ }# K2 @$ o- E, P - address: 0x3C
0 v( x8 T" @' B$ H - rotation: 180: S9 T0 @& n0 B: T; Z
- brightness: 30%3 O& [# k2 l2 x& @1 T! N- D6 W
8 s0 i$ G1 R8 Q( R2 B2 J5 J7 l+ x- pages:0 I P! Z/ {. }* ~4 X) @
- # - id: page1
1 o. x9 C4 _( R$ k2 O! a - # lambda: |-
; S! ~( w( e. R1 U$ [) o - # it.printf(0, 30, id(font3), "S:%s", id(sec).state ? "ON" : "OFF");
" L" ~" g6 J2 ^+ N
/ L7 W8 H, j* [4 q) \- - id: page1
8 t' ?% }$ ?+ V! ?3 u5 k0 b. {: ` - lambda: |-( ~. m. Y3 T# \
- it.print(47, 0, id(font2), "Info");
7 \( ^- |4 P& U; O - it.line(0, 22, 128, 22);' |" n$ \- M3 f* g. t
- it.line(0, 23, 128, 23);; d2 Q$ g S( p6 X- o
- it.line(0, 24, 128, 24);
8 a7 ^ L4 V, J' J+ [ - it.printf(0, 35, id(font1), "CPU: %.0f%%", id(cpu).state);4 h9 c( S% H5 T9 V8 {3 e
/ a7 l# c, J, ?. Z# ^( o- it.printf(0, 55, id(font1), "MEM:%.0f %/%.0fMB", id(memoryused).state,id(memorytotal).state);
; e1 \ `3 l& t! J - , U2 D- A' M' ], Q6 L
- # it.rectangle(0, 0, 128, 64);7 k8 P5 Z" Y- R: ?; h
- - id: page2
" }) h) P+ l+ [: h/ W - lambda: |-8 V( D( E% [1 h$ L* [$ j4 U0 M
- it.print(0, 0, id(font2), "Network Speed");( r+ [: m* g% x- c- _+ h3 f6 x
- it.line(0, 22, 128, 22);0 _: s" [9 b9 W+ N9 [+ U2 `" q8 g$ O+ m' K
- it.line(0, 23, 128, 23);. H: q% v" v r# o4 z' j5 L
- it.line(0, 24, 128, 24);- `4 W" i( g1 X* z. E0 o) q
- it.printf(0, 35, id(font1), "U: %.0f Kbps", id(up).state);2 U( C. M8 n1 f! C8 v A
- it.printf(0, 55, id(font1), "D: %.0f Kbps", id(down).state);0 d: o% g* X1 E
- - id: page3 I. Y/ Q7 B% R( X8 H- b+ ~4 m
- lambda: |-
+ c" g8 B- ?) F" ` C- y - it.print(24, 0, id(font2), "Disk State ");
% D4 o7 [( _% j# Q- U- N - it.line(0, 22, 128, 22);
. o3 F7 t0 q/ l. `, |, x - it.line(0, 23, 128, 23);
5 q6 w" t5 R( T" P* X" y+ W - it.line(0, 24, 128, 24);
% x9 d0 F, k/ J- X. z" e - it.printf(0, 35, id(font1), "Use:%s%/%s", id(sdausage).state.c_str(),id(sdatotal).state.c_str());$ y) H$ w; f) N4 T. D
- it.printf(0, 55, id(font1), "Temp: %.0f °C", id(sdatemp).state);4 r: O% o& `$ Y3 ]& {
- . l" c* n# T! H/ x1 m: l
- # - id: page3
2 ~+ J( T$ I$ T/ S1 c: I - # lambda: |-; c$ x# a4 [7 Y1 X" e7 E
- # it.print(0, 10, id(font3), "WOW!!!");
0 b* p. c* m0 r* t - # - id: page4( ?% E* M0 S5 g0 {% f
- # lambda: |-7 u! u' m) I; o. l7 `9 a# R
- # it.print(0, 10, id(font3), "Fantastic!!");
+ w! w! w' k3 O - # - id: page5
) y, I9 V5 k) q - # lambda: |-
' t- q9 b" Z% r; { - # it.image(0, 0, id(my_image));5 E0 k3 z6 b5 c: E3 J+ E% j
- - id: showtime
a5 l( {( C6 A' Q" S% G }3 Z - lambda: |-
# \, s! ~) u2 v5 I - it.print(40, 0, id(font2), "Clock");
/ C( _+ n+ @% B+ n7 c; G- v( H: D0 O - it.line(0, 22, 128, 22);
5 ?. e+ b$ h* \# I; ~* ], b8 ^) O1 X, K - it.line(0, 23, 128, 23);
- Q1 P; E) w' k z5 P9 X2 V - it.line(0, 24, 128, 24);
. W9 A, d% n3 }8 ]4 g* C$ v - it.strftime(15, 42, id(font3), "%H:%M:%S", id(sntp_time).now());% T' F/ V$ [' h5 @ \6 N
- it.strftime(25, 26, id(font1), "%Y-%m-%d", id(sntp_time).now());
! J, v( m7 L d2 V8 O
& y' c1 I+ k2 r$ ?# t9 T% @- 5 |( ~3 e% N8 m' K. x
- ota:
7 b9 m+ m# S' r2 w - ( L2 i# x8 k/ s) l$ J$ o
- sensor:1 D6 @3 w& v3 a1 v
- - platform: homeassistant+ N+ Y" O# u; c/ f
- name: "dsm load"8 K( n+ ^* _2 \. Q+ D
- id: "cpu"/ S6 O2 c3 c4 k& N; d
- entity_id: sensor.synology_dsm_cpu_load_total
4 x, L) v4 n+ i - " m* R3 I: ~7 F
- - platform: homeassistant
# h! ~3 c- ^6 K5 E# ] - name: "dsm down"" ]- g2 v1 H4 b8 m
- id: "down"/ H8 ~8 t% l, O5 i, q
- entity_id: sensor.synology_dsm_network_down! T+ a% y( a6 L; x3 v+ F
4 v p' L3 o4 d' n$ w: }- - platform: homeassistant
3 D; P" q. W- X: W7 L - name: "dsm up"
, T: @" v: q' c - id: "up", m" s! S* W, I
- entity_id: sensor.synology_dsm_network_up
, M( J/ z5 a$ t: q - . B( r1 Q6 _" [7 c- O
- - platform: homeassistant" T8 u9 O1 j/ e0 l) h9 M, k0 M
- name: "memory total"4 K+ L, C4 Q9 s2 m x- q
- id: "memorytotal"" t& p0 X* ?1 e- e5 T" V; L5 Z
- entity_id: sensor.synology_dsm_memory_size& }% x+ A) F% t0 Q" _: O
- 9 j. @6 X# K3 f1 O
- - platform: homeassistant9 [% O" l4 g5 ?+ V' e
- name: "memory usage"* ]' u6 z: L3 h
- id: "memoryavailable"* @8 R+ _- q( p8 W, C$ P
- entity_id: sensor.synology_dsm_memory_available_real+ l% ?# h E8 F( q7 D* @) ~( f
- 5 C. ]! c- l) g! X) `: X. R
- - platform: homeassistant: D7 `4 c- G2 E3 \; `2 r! v
- name: "memory usage"7 a* n+ r1 n" o* V9 V: X
- id: "memoryusage"0 S2 @- z, Q; p
- entity_id: sensor.synology_dsm_memory_usage_real3 z! n, e( \7 m, V9 O
- 7 v" g5 s- Y2 h) W' j* }
- : N. q2 k: \+ E$ c
- - name: "memoryused"+ d, s+ G* ^0 S" U1 U$ \+ y
- id: "memoryused"
- k8 L' i/ y1 Z; b) Y - platform: "template"
- l5 Z, h# A. R( h5 E7 j: z - lambda: |-& e0 `2 J1 U% ?* J8 i% e
- return id(memorytotal).state - id(memoryusage).state/100*id(memorytotal).state ;
' s( e: X3 n9 Q2 i7 Q - update_interval: 30s
% {7 }4 L: K0 R - " Z. j [: R2 q" q# Q
- - platform: homeassistant
) }0 k q# C _ - name: "sdatemperature"* R3 Q- _' t4 C, }# z" ^
- id: "sdatemp"
1 f* y9 D: `4 R - entity_id: sensor.synology_dsm_temperature_sda 8 r2 M* b X4 [: D x
# H2 v- }, H4 U" G b& W- * ~% c8 {; U( D. ^
- text_sensor:7 ~3 h: W6 V4 l8 c/ i
- - platform: homeassistant; p) q6 U+ ^1 l# e$ [
- name: "sda total"+ [2 z( _" k; `
- id: "sdatotal") r( K4 R( B$ p" F7 Z6 y2 _3 {7 F8 [
- entity_id: sensor.synology_dsm_total_size_volume_1# ]) B3 e( A/ N& D
- - platform: homeassistant
: h) a! f. F; I9 P+ l: o: n& E - name: "sda usage"$ g( Q6 L( \9 u% M
- id: "sdausage"
2 B6 K V/ i J - entity_id: sensor.synology_dsm_used_space_volume_1
x+ k$ Y, J: ~; `) f
2 s& X/ h' |$ l' |0 w# B9 E- binary_sensor:; w9 P0 H4 {% H- E( L+ h6 {- _
- - platform: homeassistant
7 F6 Q, x. X: o9 E - name: "sec"- K0 Q V9 G7 A( `9 G; i' }. v
- id: "sec". S) n8 C5 n8 V9 E6 ^
- entity_id: input_boolean.sec_office4 p" X- E9 Z: T9 f2 L
& _ E: H% K0 e) C- interval:
' B; C9 Y. f4 F - - interval: 10s
N, Q+ K3 y) Y# E - then:4 k) v& _. Q( A3 K' u
- - display.page.show_next: ssd1306
; }- g2 V0 |: c! p - #- component.update: my_display
. t( W. W3 d/ C I4 O - font:
7 l: g" U& ~ a6 |7 z! B - - file: 'arial.ttf'
0 J1 q* F% d8 h - id: font1
" |/ F( k1 {; o" n - size: 15% ` n; i1 |; R" l4 J* `/ e
- glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
/ T/ d8 H5 u) ]/ H0 d" Z0 } - - file: 'arial.ttf'
0 c) Z/ R4 O- c* E - id: font2" k. L- O4 m& ?/ U% d \- X
- size: 18, @; L9 v) e; `' x
- glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
" t# i2 n1 {5 O; \& y# c% \ T1 g
. A: g4 _% d2 i& t% M, P) h% [- } |4 F/ ]+ i
- - file: 'arial.ttf'
7 X- N2 [ |3 }- h3 Y/ q - id: font3, I% k, ?" g- k$ W
- size: 23
8 }! V" N; q7 }* i2 `2 l - glyphs: "/!%()+,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
复制代码 以上是dsm源码 你稍微阅读一下即可跟着编辑6 d- D8 Z' p, P% [9 `# X8 b4 V
! A9 n; c- n! o
' \) q, x- s5 {' w* p, l; I9 T$ [$ b7 a |
|