Updated with @Brianhanifin 's great streamlined light code! #358
This commit is contained in:
parent
adaf3d4515
commit
2e90a43ba2
|
@ -29,12 +29,16 @@ sensor:
|
|||
- from: BTC
|
||||
to: USD
|
||||
name: Bitcoin
|
||||
- from: ETH
|
||||
to: USD
|
||||
name: Ethereum
|
||||
#-------------------------------------------
|
||||
group:
|
||||
finance:
|
||||
entities:
|
||||
- sensor.tesla
|
||||
- sensor.bitcoin
|
||||
- sensor.ethereum
|
||||
- sensor.vmware
|
||||
- sensor.amazon
|
||||
|
||||
|
|
|
@ -74,26 +74,17 @@ speech_engine:
|
|||
{%- macro outside_weather() -%}
|
||||
Outside, it is going to be {{ states('sensor.dark_sky_minutely_summary') }}
|
||||
{%- endmacro -%}
|
||||
|
||||
|
||||
{%- macro light_check() -%}
|
||||
{% if states.group.all_lights.state != 'off' -%}
|
||||
There are
|
||||
{% for state in states.light if state.state == 'on' -%}
|
||||
{%- if loop.last -%}
|
||||
{{ loop.index }}
|
||||
{%- set lights_on_count = sensor.lights_on_friendly|length + 1 -%}
|
||||
{%- if lights_on_count == 1 -%}
|
||||
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 -%}
|
||||
{%- 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 -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
## Script to send notifications to Twitter as @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
|
||||
## 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
|
||||
######################################################################################################
|
||||
|
||||
|
@ -24,7 +24,8 @@ tweet_engine_setup:
|
|||
"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 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": [
|
||||
"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": [
|
||||
"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 #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 #Amazon stock prices. It is ${{ states('sensor.amazon')|round }}. #AWS"
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue