My Lounge Setup mite give other user Ideas 3 Year later

wrote this in 2019

its got beater

added some python script

a fork form

this is before the blueprints

I wanted to give the HA beater control over the gas heater climate

the rules are

only go when im watching TV and lounge lights ON (SOMEONE MUST BE HOME)
but turn off if the front door opens or the garge door opens.
and only do it in the autumn winter spring

want a simple way to control it

first a input helper (just a simple way to turn it on)

input_boolean.livingroom_climate

so here the automation

- id: af3fe49f-5825-4a61-9b14-0e0440735c60
  alias: Climate Livingroom
  trigger:
    - platform: time_pattern
      hours: "*"
      minutes: "*" # 1
    - platform: state
      entity_id:
        - binary_sensor.front_door
        - input_boolean.livingroom_climate
        - light.shelly_lounge
        - sensor.tv_status
        - binary_sensor.garage_door
  condition: []
  action:
    - data:
        entity_id: climate.gas_heater
        hvac_active: heat
        factor: 2.0
        turn_off: switch.gas_heater
        sensors_on: # all these must be on
          - input_boolean.livingroom_climate
          - light.shelly_lounge
          - sensor.tv_status
        sensors_off: # all these must be off
          - binary_sensor.front_door
          - binary_sensor.garage_door
        season:
          - winter
          - autumn
          - spring
      service: python_script.update_climate

which works well

but only want to start after 5PM most likely we are home.

Have Alexa now so

- alias: "Alexa: Gas heater control"
  trigger:
    platform: time
    at: "17:00:00"
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.livingroom_climate 
    - service: notify.alexa_media
      data_template:
        target:
          - media_player.lounge
          - media_player.office
        message: "Have taken control of the gas heater."
        data:
          type: announce
          method: all

and know when the TV goes off (going to bed)

- id: "44f3ca19-9b68-4000-b468-f97da821afeb"
  alias: TV turn off going to bed
  description: TV turn off going to bed
  trigger:
    - entity_id: sensor.tv_status
      platform: state
      to: "OFF"
  condition:
    - condition: state
      entity_id: sensor.day_night
      state: "Night"
  action:
    - data:
        entity_id: switch.lava_lamp
      service: switch.turn_off
    - data:
        entity_id: input_boolean.livingroom_climate 
      service: input_boolean.turn_off
    - service: notify.alexa_media
      data_template:
        target:
          - media_player.lounge
        message: "I Have turn off the Gas Heater and Climate control off."
        data:
          type: announce
          method: all
    - service: notify.alexa_media
      data_template:
        target:
          - media_player.lounge
        message: "Good Nite "
        data:
          type: announce
          method: all

the TV status is a smart plug tasmota with power monting

added a rule

rule1 on ENERGY#Power >= 50 do publish TV/status ON endon; on ENERGY#Power < 50 do publish TV/status OFF endon;

now buld a MQTT sensor to get the data

- platform: mqtt
  name: "TV Status"
  state_topic: "TV/status"
  qos: 1

hope this help someone out.

remember:
There more than one way to skin a cat. This how I skinned this one.