This fixes #81 the washer and dishwasher consumables now tracked

This commit is contained in:
Jeffrey Stone 2020-08-21 23:44:13 -04:00
parent 456eb2ab8c
commit 2ae93aac4d
2 changed files with 74 additions and 13 deletions

View File

@ -73,10 +73,10 @@ device_tracker:
# track_new_devices: yes
# - platform: owntracks
#
# - platform: eero_tracker
# consider_home: 300
# interval_seconds: 60
# track_new_devices: yes
- platform: eero_tracker
consider_home: 300
interval_seconds: 60
track_new_devices: yes
#only_macs: "d0:c5:f3:80:50:5e, f4:31:c3:84:1d:d1, 08:74:02:CC:C4:97, 5C:F5:DA:9B:5A:A2, 34:7C:25:CC:9D:0F, 64:52:99:93:F1:B3"
# moved to integrations package
@ -216,10 +216,7 @@ geo_location:
# ifttt:
# key: !secret IFTTT_API_KEY
# media_player:
# - platform: spotify
# client_id: !secret spotify_client
# client_secret: !secret spotify_secret
group: !include groups.yaml
@ -294,3 +291,9 @@ input_select: !include input_select.yaml
input_boolean: !include input_boolean.yaml
input_datetime: !include input_datetime.yaml
zone: !include zones.yaml
shell_command:
grocy_consume_item: "curl -k -X POST https://{{server_ip}}:9192/api/stock/products/{{product_id}}/consume -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'GROCY-API-KEY: {{grocy_key}}' -H 'cache-control: no-cache' -d '{ \"amount\": {{amount}}, \"transaction_type\": \"consume\", \"spoiled\": false }'"
grocy_chore_complete: "curl -k -X POST https://{{server_ip}}:9192/api/chores/{{chore_id}}/execute -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'GROCY-API-KEY: {{grocy_key}}' -H 'cache-control: no-cache' -d '{ \"tracked_time\": {{timestamp}}, \"done_by\": {{user}} }'"
grocy_add_item: "curl -k -X POST https://{{server_ip}}:9192/api/stock/products/{{product_id}}/add -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'GROCY-API-KEY: {{grocy_key}}' -H 'cache-control: no-cache' -d '{ \"amount\": {{amount}}, \"best_before_date\": {{best_before_date}}, \"transaction_type\": \"purchase\", \"price\": {{price}} }'"

View File

@ -5,13 +5,23 @@
# @description : Package for handling Smart Applicances and or automation to make dumb appliances seem smart.
###############################################################################
sensor:
# MQTT Sensor for DishWasher Status.
- platform: mqtt
name: "DishWasher Status"
state_topic: "house/dishwasher/status"
# MQTT Sensor for Washing Machine Status.
- platform: mqtt
name: "Washer Status"
state_topic: "house/washer/status"
automation:
- id: washer_running
alias: Washer Running
trigger:
- above: 5
entity_id: sensor.washer_power
entity_id: sensor.washer_power_2
platform: numeric_state
condition:
condition: or
@ -24,13 +34,20 @@ automation:
state: complete
action:
- service: script.washer_running
# Since the washer has run lets consume a detergent tablet
- service: shell_command.grocy_consume_item
data:
server_ip: !secret grocy_ip
grocy_key: !secret grocy_api_key
product_id: 6
amount: 1
initial_state: true
- id: washer_complete
alias: Washer Complete
trigger:
- below: 3
entity_id: sensor.washer_power
entity_id: sensor.washer_power_2
platform: numeric_state
condition:
- condition: state
@ -45,7 +62,7 @@ automation:
alias: Washer Emptied
trigger:
- platform: state
entity_id: binary_sensor.washer_door_contact
entity_id: binary_sensor.washer_door
from: 'off'
to: 'on'
action:
@ -67,6 +84,34 @@ automation:
- service: script.turn_on
entity_id: script.washer_finished_notification_audible
- id: dishwasher_idle
initial_state: true
alias: Dishwasher Idle
trigger:
- platform: state
entity_id: device_tracker.dishwasher
to: 'not_home'
action:
- service: script.dishwasher_idle
# When dishwasher connects to network assume it is running cycle. Auto consume detergent in Grocy
- id: dishwasher_running
initial_state: true
alias: Dishwasher Running
trigger:
- platform: state
entity_id: device_tracker.dishwasher
to: 'home'
action:
- service: script.dishwasher_running
- service: shell_command.grocy_consume_item
data:
server_ip: !secret grocy_ip
grocy_key: !secret grocy_api_key
product_id: 7
amount: 1
script:
washer_finished_notification_audible:
@ -91,7 +136,6 @@ script:
state: complete
- service: script.ah_report
data:
call_interuption: 1
call_washer_needs_emptying: 1
@ -116,3 +160,17 @@ script:
topic: house/washer/status
payload: complete
retain: true
dishwasher_idle:
sequence:
- service: mqtt.publish
data:
topic: house/dishwasher/status
payload: idle
retain: true
dishwasher_running:
sequence:
- service: mqtt.publish
data:
topic: house/dishwasher/status
payload: running
retain: true