adonno / Home-AssistantConfig

🏠 My Home Assistant config & docs (Hass.io based). Be sure to 🌟 this repository for updates!
155 stars 16 forks source link

Enhance fan heater in bathroom #9

Open adonno opened 4 years ago

adonno commented 4 years ago

We have a fan heater in our bathroom that has to be turned on manually and turns of automatically as soon as we hit 25 degrees.

This should be enhanced to turn on again as soon as the temperature drops as long as the lights are on

adonno commented 4 years ago

additionally, if the temperature is above 25 degrees the fan shouldn't turn on The logic will be on the switch using lambdas, I will use the home-assistants sensor to import the temperature and then uses a local logic

adonno commented 4 years ago

First I import the sensor i need from HA:

sensor:
  - platform: homeassistant
    name: "bathroomtemp"
    entity_id: sensor.temperature_sdb_eltern
    id: br_temp`

Then I'll add the logic to the switch on the relay

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3
      inverted: true
    name: "${plug_name}_button"
    on_press:
      then:
        - if:
            condition:
              lambda: 'return id(br_temp).state < 25;'
            then: 
              - switch.turn_on: relay
            else:
              - switch.turn_off: relay
adonno commented 4 years ago

that didn't work something is off with my lambda