Help to my first automation: I have a doubt

Hi friends!
I have a raspberry, dht22 sensor and relay with which since 3 years i manage the heating with a linux bash script and cron.
Now i discovered home assistant: it is very nice and i want to pass by raspbian to hassio.
I have only a few doubt about automation. I want that:
set at 6:30 am the target temperature to 20C
set at 09:00 away mode
set at 14:30 target temperature to 20C
set at 23:00 away mode (for the night)
i think to set away mode to 16C
I’m able to set climate generic, dht22 sensor and gpio switch,

the automation will be about (i write the logic, non the code):

  • first automation that active heating when target temperature>home temperature

trigger: state
condition state climate.state=on
action switch.on

it is correct?

the other automation that change the value in the climate at setting time for example:
trigger: time
condition time = 09:00
action climate.temperature = 20

etc etc (or i have to use condition time after 06:30 below 09:00)?

it is correct?

I must have the possibility to change manually the target temperature

another question, if i want the possibility to stop heating for 2 hours what can i do?

thanks!!! sorry for the first questions but before going to destroy my bash script i must be sure :slight_smile:

Home Assistant can do all of this for you but you will need to read the docs carefully and get a grasp of how to code it. What you have above will take multiple automations but is certainly do-able.

You could also use a custom component like Schedy, This way you won’t have to code as much.

ok i have to read the docs! I want only to know if the logics that i wrote is correct or I’m doing it wrong

Hello,

i think there is little error in your “logic”

in your case, it will be
trigger: state go from off to on
condition (no condition in this case)
action switch.turn_on

for stop heating for 2 hour, you can make a switch who make something like turn_off your climate, and the make a delay for 2 hour before turning_on

or make that more complex like a switch stop your automation (climate.temperature = 20), make a climate.turn_off, and turn on a script who make a 2 hour delay before reactivate your automation and you climate

you can create automation with the ui, then the code will be writed for you

    sensor:
      platform: dht
      sensor: DHT22
      pin: 17
      monitored_conditions:
        - temperature
        - humidity

    switch:
      - platform: rpi_gpio
        ports:
          23: heat

    climate:
      -  platform: generic_thermostat
         name: myhome
         heater: switch.heat
         target_sensor: sensor.DHT22.temperature
         min_temp: 14
         max_temp: 22
         ac_mode: False
         target_temp: 18
         initial_operation_mode: "on"
         away_temp: 16

    automation:
      - id : 'start6'
      - alias: 'start at 6'
        trigger:
         platform: time
         at: '06:30:00'
        action:
        - service: climate.set_temperature
           data: 
            entity_id: 
              - climate.myhome
            temperature: 20

It is correct? I have a doubt to “after: ‘06:30:00’”. i correct with AT
If at 08:00 i change manually the value? The automation restore it value?

your time trigger will need to be at: instead of after:

Perfect.
The rest of code is OK?

some of it isn’t correctly formatted for the forum so I can’t tell if the indentation is correct or not. Can you please format it correctly? There are definitely some indentation issues in there though

ok i have formatted the code. now it is ok?

SORRY FOR THIS STUPID QUESTION: i have to edit config.yaml with an editor text via SSH/SAMBA or i can do from UI web? after i have to reboot system to apply?

Remove the “-” in front of “alias”.

You could use the hassio plugin Configurator or IDE from the community addons. If you only changed the automations, you can just reload the automations, but most of the time a restart off home assistant is necessery (not a system reboot btw).

I recommend the IDE add-on if you are using HassIO

When changing indentation for sub-levels, the next level in needs to be indented by 2 spaces.

Ok. Now I’m to work. This evening I will try
Thank you for the time you spent

your automation would need to be more like this (I’m referring to the indentation issues here as well)

automation:
  - alias: 'start at 6'
    trigger:
    platform: time
    at: '06:30:00'
    action:
      - service: climate.set_temperature
        entity_id: climate.myhome
        data:
          temperature: 20

Yes. In the last 2 hours I have set up hassio and configurate it to do this. It’s OK. Tomorrow I will study how stop for xx hours. It’s very nice! Thanks.
P. S. A good android app to access to my dashboard?

I just use Google Chrome. Open HA in chrome and then in the menu select ‘add to home screen’. This will create an ‘app’ type icon on your home screen which will open HA in kiosk mode.

Sometimes there can be issues in getting it to work properly and the kiosk mode doesnt work. In this case: open HA in google chrome as above, then turn on ‘flight mode’ (ie: disable internet on your phone) then select ‘add to home screen’ from the menu. Once the icon is created on your home screen you can turn flight mode off. The ‘app’ (google chrome in kiosk mode) will then work as normal

Thank you very much