The step data is not perfect but let's give this a shot. #786

This commit is contained in:
ccostan 2020-07-02 18:55:48 -04:00
parent 5f9edafc93
commit b161dd45b1
2 changed files with 21 additions and 72 deletions

View File

@ -4,15 +4,15 @@
- alias: 'Dark House Little extra light'
trigger:
- platform: state
entity_id: sun.sun
to: below_horizon
- platform: numeric_state
entity_id: sensor.dark_sky_cloud_coverage
above: 90
- platform: state
entity_id: sensor.dark_sky_precip
to: 'rain'
- platform: numeric_state
entity_id: sensor.dark_sky_precip_intensity
above: 0.2
- platform: state
entity_id: group.family
to: 'home'
@ -30,9 +30,9 @@
- condition: numeric_state
entity_id: sensor.dark_sky_cloud_coverage
above: 90
- condition: state
entity_id: sensor.dark_sky_precip
state: 'rain'
- condition: numeric_state
entity_id: sensor.dark_sky_precip_intensity
above: 0.2
- condition: state
entity_id: binary_sensor.sleepnumber_carlo_carlo_is_in_bed
state: 'off'
@ -45,7 +45,7 @@
- condition: state
entity_id: group.family
state: 'home'
- condition: template # Only run once every ~3 hours tops.
- condition: template # Only run once every ~3 hours tops.
value_template: >
{%- if states.automation.dark_house_little_extra_light.attributes.last_triggered -%}
{{ (as_timestamp(now()) - as_timestamp(states.automation.dark_house_little_extra_light.attributes.last_triggered)) > 10000 }}

View File

@ -1,83 +1,32 @@
#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Neato Support for D7 Connected Botvac - control my [Neato Vacuum](https://amzn.to/2kqnnqu) with Home Assistant.
# Try to leverage iPhone Mobile App Data for Activity Tweets!
# You can read more about this on https://www.vCloudInfo.com
#-------------------------------------------
# homeassistant:
# customize_glob:
# "*.*_sleep_hours":
# unit_of_measurement: hours
# icon: mdi:sleep
#
#
#-------------------------------------------
sensor:
- platform: fitbit
# filename: fitbit-carlo.conf
clock_format: 12H
monitored_resources:
- "body/weight"
- "activities/steps"
- "devices/battery"
# - platform: fitbit
# filename: fitbit-stacey.conf
# clock_format: 12H
# monitored_resources:
# - "body/weight"
# - "activities/steps"
# - "devices/battery"
#-------------------------------------------
group:
fitbit:
entities:
- sensor.steps
- sensor.weight
- sensor.one_battery
##############################################################################
### Automations - Detect when things are not right. Like any Good Watchdog.
### Automations
##############################################################################
automation:
- alias: 'Missing Fitbit Alert'
initial_state: 'on'
- alias: 'Step Tracker' # https://github.com/CCOSTAN/Home-AssistantConfig/issues/786
trigger:
- platform: time
at: '11:00:00'
condition:
condition: template
value_template: >
{%- if states.sensor.steps.state.replace(",", "")|int < 1000 -%}
true
{%- endif -%}
action:
- service: script.notify_engine
data_template:
value1: "Your current fitbit steps are {{ states('sensor.steps') }} - You probably do not have it."
who: 'carlo'
apns_id: 'information'
- alias: 'Fitbit 10k'
initial_state: 'on'
trigger:
- platform: state
- platform: numeric_state
entity_id:
- binary_sensor.sleepnumber_carlo_carlo_is_in_bed
to: 'on'
condition:
- condition: template
value_template: >
{%- if states.sensor.steps.state.replace(",", "")|int > 10000 -%}
true
{%- endif -%}
- sensor.carlo_xsmax_steps
- sensor.paige_6s_steps
- sensor.steps_3
above: 5000
action:
- service: script.tweet_engine_image
data_template:
tweet: >
{{ [
"Somebody just hit {{ states('sensor.steps') }} steps on the #Fitbit!",
"Keep on moving. Somebody just hit {{ states('sensor.steps') }} #Fitbit steps.",
"#Fitness Tracking at home BY the home. Somebody just hit {{ states('sensor.steps') }} #Fitbit steps"
] | random + " Battery Level:{{ states('sensor.one_battery') }} #Self #Data"}}
"Somebody just hit {{ states('trigger.entity_id') }} steps on the #Fitbit!",
"Keep on moving. Somebody just hit {{ states('strigger.entity_id') }} #Fitbit steps.",
"#Fitness Tracking at home BY the home. Somebody just hit {{ states('trigger.entity_id') }} #Fitbit steps"
] | random + " #Self #Data"}}
image: >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/fitness.png",