Quick update to Solar stats maybe @dale3h

This commit is contained in:
ccostan 2018-03-25 11:58:56 -04:00
parent 96fc4a5740
commit 5c68565758
4 changed files with 52 additions and 17 deletions

View File

@ -23,6 +23,23 @@ notify:
### Building out some Historical stats for tweeting. ##################### ### Building out some Historical stats for tweeting. #####################
sensor: sensor:
- platform: sql
db_url: sqlite:///config/home-assistant_v2.db
queries:
- name: "Solar 24h"
column: 'solar_kwh'
unit_of_measurement: 'kWh'
query: >-
SELECT ROUND(SUM(solar_kwh), 2) AS solar_kwh
FROM (
SELECT AVG(state) AS solar_kwh
FROM states
WHERE entity_id = 'sensor.solar_now'
AND state != 'unknown'
AND last_updated >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 24 HOUR)
GROUP BY HOUR(last_updated)
) AS total_kwh;
- platform: history_stats - platform: history_stats
name: Doorbell Presses name: Doorbell Presses
entity_id: binary_sensor.skybell_stone_door_button entity_id: binary_sensor.skybell_stone_door_button
@ -129,7 +146,7 @@ group:
- sensor.sensor_count - sensor.sensor_count
- sensor.script_count - sensor.script_count
- sensor.binary_sensor_count - sensor.binary_sensor_count
- sensor.automation_count - sensor.automation_count
############################################################# #############################################################

View File

@ -1,12 +1,18 @@
## These scripts are run from /home/pi # ## These scripts are run from /home/pi
#
# #!/bin/bash
#
# cd /home/hass/.homeassistant
# source /srv/hass/hass_venv/bin/activate
#
# echo "Processing update"
# pip3 install --upgrade homeassistant
#
# hass --script check_config
# exit
#!/bin/bash #!/bin/bash
cd /home/hass/docker_files
cd /home/hass/.homeassistant docker-compose down
source /srv/hass/hass_venv/bin/activate docker-compose pull
docker-compose up -d
echo "Processing update"
pip3 install --upgrade homeassistant
hass --script check_config
exit

12
config/shell_scripts/gitpull.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
cd /home/hass/docker_files
docker-compose exec home-assistant python -m homeassistant --config /config --script check_config
cd /home/hass/docker_files/homeassistant
git pull origin master
cd /home/hass/docker_files
docker-compose exec home-assistant python -m homeassistant --config /config --script check_config
cd ~
exit

View File

@ -1,16 +1,16 @@
## These scripts are run from /home/pi
#!/bin/bash #!/bin/bash
cd /home/hass/docker_files
docker-compose exec home-assistant python -m homeassistant --config /config --script check_config
cd /home/hass/.homeassistant cd /home/hass/docker_files/homeassistant
source /srv/hass/hass_venv/bin/activate
hass --script check_config
git add . git add .
git status git status
echo -n "Enter the Description for the Change: " [Minor Update] echo -n "Enter the Description for the Change: [Minor Edit] "
read CHANGE_MSG read CHANGE_MSG
CHANGE_MSG=${CHANGE_MSG:-Minor Edit}
git commit -m "${CHANGE_MSG}" git commit -m "${CHANGE_MSG}"
git push origin master git push origin master
cd ~
exit exit