Browse Source

Update mobile ui; add docker host system stats, add human home/away tracking

master
KemoNine 2 years ago
parent
commit
9b635ca1a3
  1. 2
      .gitignore
  2. 3
      appdaemon/.gitignore
  3. 3
      appdaemon/dashboards/Desk.dash
  4. 5
      appdaemon/dashboards/Desk_Mobile.dash
  5. 5
      appdaemon/dashboards/Main.dash
  6. 5
      appdaemon/dashboards/Main_Mobile.dash
  7. 4
      appdaemon/dashboards/Status.dash
  8. 6
      appdaemon/dashboards/Status_Mobile.dash
  9. 50
      appdaemon/dashboards/status.yaml
  10. 4
      appdaemon/secrets-example.yaml
  11. 15
      automations/desk_human_kiosk.yaml
  12. 8
      configuration.yaml
  13. 4
      secrets-example.yaml
  14. 14
      sensors/README.md
  15. 31
      sensors/server.yaml
  16. 1
      shell_commands.yaml

2
.gitignore

@ -20,9 +20,11 @@ __pycache__/
deps/
ip_bans.yaml
known_devices.yaml
tracked_devices.yaml
secrets.yaml
ToDo.md
OZW_Log.txt
host-id-rsa
!.github
!.gitignore

3
appdaemon/.gitignore

@ -1,2 +1,3 @@
compiled
cameras.yaml
cameras.yaml
tracked_Devices.yaml

3
appdaemon/dashboards/Desk.dash

@ -4,7 +4,7 @@ widget_dimensions: [120, 120]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 6
rows: 4
rows: 6
global_parameters:
use_comma: 0
precision: 2
@ -32,4 +32,5 @@ layout:
- nav_main, clock(2x1), nav_mobile, nav_back, reload
- temp, heat_index, humidity, light, light_value, pressure
- ac_status, ac_current, battery_status, battery_capacity, battery_voltage, battery_current
- cpu_temperature, load_5m, memory_use_percent, swap_use_percent, disk_use_root, disk_use_tank
- zwave_gateway_status, zwave_multi_sensor_attic_status, multi_sensor_attic, multi_sensor_attic_battery_level, multi_sensor_attic_temperature, multi_sensor_attic_humidity, spacer

5
appdaemon/dashboards/Desk_Mobile.dash

@ -4,7 +4,7 @@ widget_dimensions: [120, 120]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 3
rows: 8
rows: 11
global_parameters:
use_comma: 0
precision: 2
@ -37,3 +37,6 @@ layout:
- battery_capacity, battery_voltage, battery_current
- zwave_gateway_status, zwave_multi_sensor_attic_status, multi_sensor_attic
- multi_sensor_attic_battery_level, multi_sensor_attic_temperature, multi_sensor_attic_humidity
- load_5m, cpu_temperature, cpu_speed
- memory_use_percent, swap_use_percent, spacer
- disk_use_root, disk_use_tank, spacer

5
appdaemon/dashboards/Main.dash

@ -79,10 +79,11 @@ layout:
- include: header
- include: cameras
- include: entertainment
- include: tracked_devices
- nav_main, clock(3x1), nav_mobile, reload
- nav_weather, current_weather(2x1), nav_sensors, nav_desk, nav_status
- nav_weather, current_weather(2x1), tracked_device_1, tracked_device_2, nav_desk
- bedroom_tv(3x2), living_room_tv(3x2)
-
- nav_cameras, nav_entertainment, spacer(4x1)
- nav_sensors, nav_entertainment, nav_cameras, nav_status, spacer(3x1)
- camera_stairs(3x2), camera_living_room(3x2)
-

5
appdaemon/dashboards/Main_Mobile.dash

@ -79,15 +79,16 @@ layout:
- include: header
- include: cameras
- include: entertainment
- include: tracked_devices
- nav_main_mobile, spacer, reload
- nav_desktop, clock(2x1)
- nav_weather, current_weather(2x1)
- nav_sensors, nav_desk, nav_status
- nav_desk, tracked_device_1, tracked_device_2
- nav_sensors, nav_cameras, nav_status
- bedroom_tv(3x2)
-
- living_room_tv(3x2)
-
- nav_cameras, nav_entertainment, spacer
- camera_stairs(3x2)
-
- camera_living_room(3x2)

4
appdaemon/dashboards/Status.dash

@ -4,7 +4,7 @@ widget_dimensions: [120, 120]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 5
rows: 3
rows: 5
global_parameters:
use_comma: 0
precision: 2
@ -30,3 +30,5 @@ layout:
- include: status
- ac_status, ac_current, ac_voltage, spacer(2x1)
- battery_status, battery_capacity, battery_voltage, battery_current, battery_health
- load_5m, cpu_temperature, spacer(3x1)
- memory_use_percent, swap_use_percent, disk_use_root, disk_use_tank, cpu_speed

6
appdaemon/dashboards/Status_Mobile.dash

@ -4,7 +4,7 @@ widget_dimensions: [120, 120]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 3
rows: 5
rows: 7
global_parameters:
use_comma: 0
precision: 2
@ -31,4 +31,6 @@ layout:
- include: status
- ac_status, ac_current, ac_voltage
- battery_status, battery_capacity, battery_voltage
- spacer, battery_current, battery_health
- battery_current, battery_health
- cpu_temperature, memory_use_percent, swap_use_percent
- load_5m, disk_use_root, disk_use_tank, spacer

50
appdaemon/dashboards/status.yaml

@ -53,3 +53,53 @@ battery_health:
widget_type: sensor
entity: sensor.sopine_battery_health
units: ""
memory_use_percent:
widget_type: gauge
entity: sensor.memory_use_percent
title: "Memory"
units: "%"
min: 0
max: 100
swap_use_percent:
widget_type: gauge
entity: sensor.swap_use_percent
title: "Swap"
units: "%"
min: 0
max: 100
load_5m:
widget_type: sensor
entity: sensor.load_5m
title: "5 Minute Load"
units: ""
disk_use_root:
widget_type: gauge
entity: sensor.disk_use_root
title: "/"
units: "%"
min: 0
max: 100
disk_use_tank:
widget_type: gauge
entity: sensor.disk_use_tank
title: "/tank"
units: "%"
min: 0
max: 100
cpu_speed:
widget_type: sensor
entity: sensor.cpu_speed
title: "CPU Frequency"
units: "Hz"
cpu_temperature:
widget_type: sensor
title: CPU
entity: sensor.cpu_temperature
units: "°F"

4
appdaemon/secrets-example.yaml

@ -5,3 +5,7 @@ appdaemon_elevation: 0
appdaemon_latitude: 0
appdaemon_longitude: 0
appdaemon_time_zone: UTC
tracked_device_1: android_phone_1
tracked_device_1_title: Android Phone (1)
tracked_device_2: android_phone_2
tracked_device_2: Android Phone (2)

15
automations/desk_human_kiosk.yaml

@ -0,0 +1,15 @@
# Desk kiosk on/off
- id: desk_kiosk
alias: Desk Kiosk
trigger:
- platform: state
entity_id: !secret tracked_device_1
action:
- service: shell_command.lightdm
data_template:
action: >-
{% if trigger.to_state.state == 'home' %}
start
{% else %}
stop
{% endif %}

8
configuration.yaml

@ -159,11 +159,19 @@ logbook:
- sensor.pcf8523
# Shell Commands
shell_command: !include shell_commands.yaml
# Scenes
# https://home-assistant.io/components/scene/
#scene: !include misc/scenes.yaml
# Automations
automation: !include_dir_merge_list automations/
# Discover some devices automatically
discovery:
ignore:

4
secrets-example.yaml

@ -9,6 +9,10 @@ homeassistant_whitelist_config: ./
http_base_url: ""
http_password: ""
# Devices
tracked_device_1: android_phone_1
tracked_device_2: android_phone_2
# Database Setup
recorder_db_url: "postgresql://user:password@SERVER_IP/DB_NAME"

14
sensors/README.md

@ -1,3 +1,17 @@
# Sensors
Various sensor configurations. Each of the ```yaml``` files is a *different* sensor.
## SSH Voodoo
Some sensors are setup to use ssh -> host to bail out of the docker container for monitoring. You'll need to run the below setup on the Docker host to get these sensors working.
``` bash
useradd -m -s /bin/bash home-assistant
sudo -sHu home-assistant
ssh-keygen -t rsa -b 4096
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa > /path/to/config/host-id-rsa
```

31
sensors/server.yaml

@ -0,0 +1,31 @@
# These are respresentative of the host system too despite containerization
- platform: systemmonitor
resources:
- type: memory_use_percent
- type: swap_use_percent
- type: load_5m
# SSH voodoo to work around containerization
- platform: command_line
name: disk_use_root
command: "ssh -i /config/host-id-rsa -o StrictHostKeyChecking=no home-assistant@172.30.0.1 df --output=pcent / | sed 1d | sed 's/ //g' | sed 's/%//g'"
unit_of_measurement: "%"
# SSH voodoo to work around containerization
- platform: command_line
name: disk_use_tank
command: "ssh -i /config/host-id-rsa -o StrictHostKeyChecking=no home-assistant@172.30.0.1 df --output=pcent /tank | sed 1d | sed 's/ //g' | sed 's/%//g'"
unit_of_measurement: "%"
# Works on SOPine ; standard cpuspeed patform doesn't support SOPine
- platform: command_line
name: cpu_speed
command: "ssh -i /config/host-id-rsa -o StrictHostKeyChecking=no home-assistant@172.30.0.1 cpufreq-info -f"
unit_of_measurement: "Hz"
# Thermal zone for CPU on SOPine and other arm boards
- platform: command_line
name: cpu_temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(2) }}'

1
shell_commands.yaml

@ -0,0 +1 @@
lightdm: "ssh -i /config/host-id-rsa -o StrictHostKeyChecking=no home-assistant@172.30.0.1 sudo systemctl {{ action }} lightdm"
Loading…
Cancel
Save