Skip to content

Commit

Permalink
添加了一些新的配置
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanDai committed Aug 11, 2020
1 parent 8908f07 commit 92d4c6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ sensor:
- DISK_USED # 可选,已用硬盘
- SWAP_USED # 可选,已用SWAP
- VPS_IP # 可选,VPS IP
- SSH_PORT
- HOSTNAME
- OS
- NODE_LOCATION
- DATA_NEXT_RESET
```
以上信息请从搬瓦工的控制页面获取。
Expand Down
7 changes: 5 additions & 2 deletions custom_components/bandwagonhost/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
'VPS_LOAD_5M':['VPS LOAD 5M', '', 'mdi:cpu-32-bit'],
'VPS_LOAD_15M':['VPS LOAD 15M', '', 'mdi:cpu-32-bit'],
'VPS_IP':['VPS IP', '', 'mdi:ip'],
'SSH_PORT':['SSH_PORT', '', 'mdi:ip'],
'SSH_PORT':['SSH PORT', '', 'mdi:ip'],
'HOSTNAME':['HOSTNAME', '', 'mdi:ip'],
'OS':['OS', '', 'mdi:ip'],
'NODE_LOCATION':['NODE_LOCATION', '', 'mdi:ip'],
'NODE_LOCATION':['NODE LOCATION', '', 'mdi:ip'],
'DATA_NEXT_RESET':['DATA NEXT RESET', '', 'mdi:ip'],
}

SCAN_INTERVAL = timedelta(seconds=1200)
Expand Down Expand Up @@ -166,6 +167,8 @@ def update(self):
self._state = json_obj_info['os']
elif self._condition == 'NODE_LOCATION':
self._state = json_obj_info['node_location']
elif self._condition == 'DATA_NEXT_RESET':
self._state = json_obj_info['data_next_reset']
else:
self._state = "something wrong"
except ConnectionError:
Expand Down

0 comments on commit 92d4c6d

Please sign in to comment.