homeassistant/packages/closet.yaml

71 lines
2.0 KiB
YAML
Raw Permalink Normal View History

homeassistant:
customize:
fan.fan_state:
friendly_name: 'Fan State (manual override)'
sensor.closet_temperature:
friendly_name: 'Closet Temperature (C)'
input_number.fan_on_temp:
friendly_name: 'Fan On Set Temperature (C)'
# CLOSET ENTITIES
fan:
- platform: mqtt
name: "fan state"
state_topic: "closet/status/fan/"
command_topic: "closet/fan"
switch:
- platform: mqtt
name: "Fan Automation Enabled"
state_topic: "closet/status/fan/automation"
command_topic: "closet/fan/automation"
state_on: "enabled"
state_off: "disabled"
payload_on: "enable"
payload_off: "disable"
icon: mdi:fan
sensor:
- platform: mqtt
name: "closet temperature"
state_topic: "closet/status/temp"
unit_of_measurement: 'Celcius'
# Example configuration.yaml entry using 'input_number' in an action in an automation
input_number:
fan_on_temp:
name: Fan On Temp
initial: 25
min: 20
max: 30
step: 0.5
unit_of_measurement: Celcuis
icon: mdi:target
mode: "box"
# This automation script runs when a value is received via MQTT on retained topic: setTemperature
# It sets the value slider on the GUI. This slides also had its own automation when the value is changed.
automation:
- alias: Closet Fan On Set Temperature slider
trigger:
platform: mqtt
topic: 'closet/status/fan/automation/temp'
action:
service: input_number.set_value
data_template:
entity_id: input_number.fan_on_temp
value: "{{ trigger.payload }}"
# This second automation script runs when the target temperature slider is moved.
# It publishes its value to the same MQTT topic it is also subscribed to.
- alias: Closet Fan Temp Slider Moved
trigger:
platform: state
entity_id: input_number.fan_on_temp
action:
service: mqtt.publish
data_template:
topic: 'closet/fan/automation/temp'
retain: true
payload: "{{ states('input_number.fan_on_temp') }}"