Updated with @Brianhanifin 's great streamlined light code! #358

This commit is contained in:
ccostan 2018-05-18 13:43:03 -04:00
parent adaf3d4515
commit 2e90a43ba2
3 changed files with 15 additions and 18 deletions

View File

@ -29,12 +29,16 @@ sensor:
- from: BTC - from: BTC
to: USD to: USD
name: Bitcoin name: Bitcoin
- from: ETH
to: USD
name: Ethereum
#------------------------------------------- #-------------------------------------------
group: group:
finance: finance:
entities: entities:
- sensor.tesla - sensor.tesla
- sensor.bitcoin - sensor.bitcoin
- sensor.ethereum
- sensor.vmware - sensor.vmware
- sensor.amazon - sensor.amazon

View File

@ -74,26 +74,17 @@ speech_engine:
{%- macro outside_weather() -%} {%- macro outside_weather() -%}
Outside, it is going to be {{ states('sensor.dark_sky_minutely_summary') }} Outside, it is going to be {{ states('sensor.dark_sky_minutely_summary') }}
{%- endmacro -%} {%- endmacro -%}
{%- macro light_check() -%} {%- macro light_check() -%}
{% if states.group.all_lights.state != 'off' -%} {% if states.group.all_lights.state != 'off' -%}
There are There are
{% for state in states.light if state.state == 'on' -%} {%- set lights_on_count = sensor.lights_on_friendly|length + 1 -%}
{%- if loop.last -%} {%- if lights_on_count == 1 -%}
{{ loop.index }} The {{ sensor.lights_on_friendly }} is the only light on right now.
{%- else -%}
There are {{ lights_on_count }} lights on right now.
The {{ sensor.lights_on_friendly }} are on.
{%- endif -%} {%- endif -%}
{%- endfor %}
lights on right now.
{% set comma = joiner(', ') %}
The
{% for group in states.group|groupby('state') -%}
{%- for entity in group.list if entity.state == 'on' and entity.name.split(' ')[1]|lower == 'lights' and entity.name.split(' ')[0]|lower != 'all' and entity.name.split(' ')[0]|lower != 'interior' -%}
{{ ' and' if loop.last and not loop.first else comma() }}
{{ entity.name }}
{%- endfor -%}
{%- endfor -%}
.
{%- endif -%} {%- endif -%}
{%- endmacro -%} {%- endmacro -%}

View File

@ -2,7 +2,7 @@
## Script to send notifications to Twitter as @BearStoneHA. ## Script to send notifications to Twitter as @BearStoneHA.
## Publish on Facebook as well - https://www.facebook.com/BearStoneHA/ ## Publish on Facebook as well - https://www.facebook.com/BearStoneHA/
## If you do end up using this package, please consider using one or two of the canned tweets that calls back to my main repo ## If you do end up using this package, please consider using one or two of the canned tweets that calls back to my main repo
## so others can bring thier homes online as well. I have an active search for #RandomFacts that helps me find new HA homes using my package online. ## so others can bring thier homes online as well. I have an active search for #Randomstats that helps me find new HA homes using my package online.
## Enhancements by @dale3h ## Enhancements by @dale3h
###################################################################################################### ######################################################################################################
@ -24,7 +24,8 @@ tweet_engine_setup:
"solar": [ "solar": [
"I am keeping track of the current #Tesla stock price. It is ${{ states('sensor.tesla')|round }}. #Solar", "I am keeping track of the current #Tesla stock price. It is ${{ states('sensor.tesla')|round }}. #Solar",
"The #ChevyBolt was charged for about {{ states.sensor.bolt_charging_time.attributes.value|replace('m', '') }} minutes in the last 7 days.", "The #ChevyBolt was charged for about {{ states.sensor.bolt_charging_time.attributes.value|replace('m', '') }} minutes in the last 7 days.",
"The Official Diecast P85 Model S Red (https://amzn.to/2Hkkl0S) link - Out of stock like the originals. :)" "The Official Diecast P85 Model S Red (https://amzn.to/2Hkkl0S) link - Out of stock like the originals. :)",
"Solar power from #Tesla is the life blood of this whole operation. (https://www.vcloudinfo.com/2018/01/going-green-to-save-some-green-in-2018.html)"
], ],
"throwback": [ "throwback": [
"One of the most popular #SmartHome Projects I have done: (https://www.vcloudinfo.com/2017/07/visualizing-smart-home-using-home.html)", "One of the most popular #SmartHome Projects I have done: (https://www.vcloudinfo.com/2017/07/visualizing-smart-home-using-home.html)",
@ -84,6 +85,7 @@ tweet_engine_setup:
"stocks": [ "stocks": [
"I am keeping track of the current #Tesla stock price. It is ${{ states('sensor.tesla')|round }}. #Solar", "I am keeping track of the current #Tesla stock price. It is ${{ states('sensor.tesla')|round }}. #Solar",
"I am keeping track of the current #Bitcoin prices. It is ${{ states('sensor.bitcoin')|round }}. #BTC", "I am keeping track of the current #Bitcoin prices. It is ${{ states('sensor.bitcoin')|round }}. #BTC",
"I am keeping track of the current #Ethereum prices. It is ${{ states('sensor.ethereum')|round }}. #ETH",
"I am keeping track of the current #VMware stock price. It is ${{ states('sensor.vmware')|round }}. #vExpert", "I am keeping track of the current #VMware stock price. It is ${{ states('sensor.vmware')|round }}. #vExpert",
"I am keeping track of the current #Amazon stock prices. It is ${{ states('sensor.amazon')|round }}. #AWS" "I am keeping track of the current #Amazon stock prices. It is ${{ states('sensor.amazon')|round }}. #AWS"
], ],