Skip to content

Instantly share code, notes, and snippets.

@dennyreiter
Created August 4, 2019 21:51
Show Gist options
  • Save dennyreiter/81c0f0ffc5f2256f03dd512b5a25f49f to your computer and use it in GitHub Desktop.
Save dennyreiter/81c0f0ffc5f2256f03dd512b5a25f49f to your computer and use it in GitHub Desktop.
B-Hyve Home Assistant
#################################################################
# #
# Binary Sensors #
# #
#################################################################
binary_sensor:
- platform: mqtt
name: Sprinkler Watering
state_topic: "bhyve/message"
value_template: "{{ value_json.event }}"
payload_on: "watering_in_progress_notification"
payload_off: "watering_complete"
####################################################
# #
# Sensor - MQTT #
# #
####################################################
- platform: mqtt
name: Sprinkler Battery
state_topic: "bhyve/device/5d2cc1bc4f0c7d841e16225b/details"
value_template: "{{ value_json.battery.percent }}"
unit_of_measurement: '%'
icon: mdi:battery
device_class: battery
- platform: mqtt
name: Sprinkler Status
state_topic: "bhyve/device/5d2cc1bc4f0c7d841e16225b/details"
json_attributes_topic: "bhyve/device/5d2cc1bc4f0c7d841e16225b/details"
value_template: "{{ value_json.status.run_mode }}"
- platform: mqtt
name: Sprinkler Next Watering
state_topic: "bhyve/device/5d2cc1bc4f0c7d841e16225b/details"
value_template: "{{ value_json.status.next_start_time }}"
- platform: mqtt
name: Sprinkler Message
state_topic: "bhyve/message"
value_template: "{{ value_json.event }}"
json_attributes_topic: "bhyve/message"
#################################################################
# #
# Switches #
# #
#################################################################
switch:
####################################################
# #
# Switch - MQTT #
# #
####################################################
- platform: mqtt
name: Sprinklers
command_topic: "bhyve/device/5d2cc1bc4f0c7d841e16225b/zone/1/set"
state_on: '{"state": "ON", "time": 10}'
state_off: '{"state": "OFF"}'
#################################################################
# #
# Scripts #
# #
#################################################################
script:
'sprinklers_on':
alias: Turn on Sprinklers
sequence:
- data:
payload: '{"state": "ON", "time": 10}'
topic: 'bhyve/device/5d2cc1bc4f0c7d841e16225b/zone/1/set'
service: mqtt.publish
'sprinklers_off':
alias: Turn off Sprinklers
sequence:
- data:
payload: '{"state": "OFF"}'
topic: 'bhyve/device/5d2cc1bc4f0c7d841e16225b/zone/1/set'
service: mqtt.publish
#################################################################
# #
# Automations #
# #
#################################################################
automation:
- id: 'initialize_sprinklers'
alias: Initialize Sprinklers
trigger:
- event: start
platform: homeassistant
condition: []
action:
- data:
topic: bhyve/device/refresh
service: mqtt.publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment