From 4dd62c457bc14c303ed41e5b5a0a990620da2c3e Mon Sep 17 00:00:00 2001 From: ccostan Date: Sat, 24 Mar 2018 20:06:16 -0400 Subject: [PATCH] Merged @zac300's changes back into the repo. nice enhancements. --- config/packages/twitter.yaml | 60 ++++++++++++++++++++++++++++++------ config/script/tweet.yaml | 10 ++++-- 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/config/packages/twitter.yaml b/config/packages/twitter.yaml index 2f7cc1fc..4043f87f 100755 --- a/config/packages/twitter.yaml +++ b/config/packages/twitter.yaml @@ -68,12 +68,54 @@ sensor: duration: days: 7 - # - platform: rest - # name: July 4th Countdown - # resource: http://api.wolframalpha.com/v1/result?appid=JIUY8U-4V8KY45VT1&i=How%20many%20days%20until%204th%20July%202018 - # value_template: "{{ (value|replace(' days', '')) | int }}" - # unit_of_measurement: Days - # scan_interval: 43200``` +### Building some interesting stats for tweeting. ### + - platform: template + sensors: + sensor_count: + friendly_name: 'Number of Sensors' + value_template: > + {%- set domains = ['sensor'] -%} + {%- for domain in domains -%} + {%- for item in states[domain] -%} + {% if loop.first %} + {{loop.length}} + {% endif %} + {%- endfor -%} + {%- endfor -%} + automation_count: + friendly_name: 'Number of Automations' + value_template: > + {%- set domains = ['automation'] -%} + {%- for domain in domains -%} + {%- for item in states[domain] -%} + {% if loop.first %} + {{loop.length}} + {% endif %} + {%- endfor -%} + {%- endfor -%} + script_count: + friendly_name: 'Number of Scripts' + value_template: > + {%- set domains = ['script'] -%} + {%- for domain in domains -%} + {%- for item in states[domain] -%} + {% if loop.first %} + {{loop.length}} + {% endif %} + {%- endfor -%} + {%- endfor -%} + binary_sensor_count: + friendly_name: 'Number of Binary Sensors' + value_template: > + {%- set domains = ['binary_sensor'] -%} + {%- for domain in domains -%} + {%- for item in states[domain] -%} + {% if loop.first %} + {{loop.length}} + {% endif %} + {%- endfor -%} + {%- endfor -%} + group: tweet_stats: @@ -140,8 +182,8 @@ automation: hide_entity: True trigger: - platform: time - hours: '/3' - minutes: 01 + hours: '/2' + minutes: 45 seconds: 00 condition: - condition: template @@ -159,7 +201,7 @@ automation: {% set pick = [ "minecraft", "solar", "solar", - "robot", "robot", "robot", "robot", "robot", "robot", "robot", "robot", "robot", + "robot", "robot", "robot", "robot", "robot", "robot", "robot", "robot", "robot","robot","robot", "door", "door", "door", "weather", "weather", "weather", "weather", "weather", "weather", "internet", "internet", "internet", "internet", diff --git a/config/script/tweet.yaml b/config/script/tweet.yaml index a1f76139..21b6c7b4 100755 --- a/config/script/tweet.yaml +++ b/config/script/tweet.yaml @@ -30,7 +30,9 @@ tweet_engine_setup: "My Home Assistant Database is currently using {{ states('sensor.database_sensor') }} MBs. To get this #Stat for your HA, visit (https://github.com/robmarkcole/HASS-filesize-sensor)", "I am running Home Assistant version {{ states('sensor.ha_installed_version') }} (https://github.com/CCOSTAN/Home-AssistantConfig#logo)", "Home Assistant has been running for {{ states('sensor.ha_uptime') }}. (https://github.com/CCOSTAN/Home-AssistantConfig#logo)", - "My Home Assistant has been tested by Travis-CI and {{states('sensor.ccostanhomeassistantconfig_state')}}. (https://github.com/CCOSTAN/Home-AssistantConfig#logo)" + "My Home Assistant has been tested by Travis-CI and {{states('sensor.ccostanhomeassistantconfig_state')}}. (https://github.com/CCOSTAN/Home-AssistantConfig#logo)", + "{{((states.sensor.sensor_count.state | int) + (states.sensor.binary_sensor_count.state | int))}} sensors feed my Smart Home #data. (https://github.com/CCOSTAN/Home-AssistantConfig#logo)", + "{{states.sensor.automation_count.state}} automations and {{states.sensor.script_count.state}} scripts make my home smart (https://github.com/CCOSTAN/Home-AssistantConfig#logo)" ], "door": [ @@ -96,7 +98,11 @@ tweet_engine_setup: "/config/www/custom_ui/floorplan/images/branding/servers4.png", "/config/www/custom_ui/floorplan/images/branding/robot.png", "/config/www/custom_ui/floorplan/images/branding/keyboard.png", - "/config/www/custom_ui/floorplan/images/branding/repo_ad4.png" + "/config/www/custom_ui/floorplan/images/branding/repo_ad4.png", + "/config/www/custom_ui/floorplan/images/branding/repo_ad2.png", + "/config/www/custom_ui/floorplan/images/branding/repo_ad3.png", + "/config/www/custom_ui/floorplan/images/branding/repo_ad.png" + ], "door": [