Boa tarde, hoje vou cá deixar o meu projecto que realizei para a automação da rega do meu jardim.
O material usado foi: um sonoff 4ch pro r2, um transformador, caixa de um quadro eletrico e as eletroválvulas que já cá existiam.
Então comecei por flashar o sonoff conforme toturial da casa (📑 Como flashar de forma simples qualquer ESP).
Depois comecei por chantar as ligacões,
Depois instalei a caixa de quadro em que o sonoff tem apoios para la encaixar e tudo.
depois das ligações feitas ficou com este aspecto.
Agora vamos as configurações da parte do HASSIO:
primeiro criei os switch
switch:
- platform: mqtt
name: "zona 1"
state_topic: "stat/rega/POWER1"
command_topic: "cmnd/rega/power1"
availability_topic: "tele/rega/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
payload_on: "ON"
payload_off: "OFF"
- platform: mqtt
name: "zona 2"
state_topic: "stat/rega/POWER2"
command_topic: "cmnd/rega/power2"
availability_topic: "tele/rega/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
- platform: mqtt
name: "zona 3"
state_topic: "stat/rega/POWER3"
command_topic: "cmnd/rega/power3"
availability_topic: "tele/rega/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
- platform: mqtt
name: "zona 4"
state_topic: "stat/rega/POWER4"
command_topic: "cmnd/rega/power4"
availability_topic: "tele/rega/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
Depois como uso packages criei um ficheiro rega.yaml com a seguinte automação:
homeassistant:
###############################################################################
# #
# C U S T O M I Z E #
# #
###############################################################################
###############################################################################
# #
# S C R I P T S #
# #
###############################################################################
script:
zona_rega_1:
sequence:
- service: switch.turn_on
entity_id: switch.zona_1
- delay: '00:20:00'
- service: switch.turn_off
entity_id: switch.zona_1
zona_rega_2:
sequence:
- service: switch.turn_on
entity_id: switch.zona_2
- delay: '00:20:00'
- service: switch.turn_off
entity_id: switch.zona_2
zona_rega_3:
sequence:
- service: switch.turn_on
entity_id: switch.zona_3
- delay: '00:20:00'
- service: switch.turn_off
entity_id: switch.zona_3
zona_rega_4:
sequence:
- service: switch.turn_on
entity_id: switch.zona_4
- delay: '00:20:00'
- service: switch.turn_off
entity_id: switch.zona_4
###############################################################################
# #
# INPUT BOOLEAN #
# #
###############################################################################
###############################################################################
# #
# A U T O M A Ç Õ E S #
# #
###############################################################################
automation:
- alias: Regar Zona 1
trigger:
- platform: time
at: '06:00:00'
condition:
- condition: time
weekday:
- mon
- wed
- fri
- sun
action:
- service: script.turn_on
data:
entity_id: script.zona_rega_1
- alias: Regar Zona 2
trigger:
- platform: time
at: '06:20:02'
condition:
- condition: time
weekday:
- mon
- wed
- fri
- sun
action:
- service: script.turn_on
data:
entity_id: script.zona_rega_2
- alias: Regar Zona 3
trigger:
- platform: time
at: '06:40:04'
condition:
- condition: time
weekday:
- mon
- wed
- fri
- sun
action:
- service: script.turn_on
data:
entity_id: script.zona_rega_3
- alias: Regar Zona 4
trigger:
- platform: time
at: '07:00:06'
condition:
- condition: time
weekday:
- mon
- wed
- fri
- sun
action:
- service: script.turn_on
data:
entity_id: script.zona_rega_4
###############################################################################
# #
# L U Z E S #
# #
###############################################################################
###############################################################################
# #
# G R O U P S #
# #
###############################################################################
group:
Switch Rega:
control: hidden
entities:
- switch.zona_1
- switch.zona_2
- switch.zona_3
- switch.zona_4
Scripts Rega:
control: hidden
entities:
- script.zona_rega_1
- script.zona_rega_2
- script.zona_rega_3
- script.zona_rega_4
Automações:
control: hidden
entities:
- automation.Regar_Zona_1
- automation.Regar_Zona_2
- automation.Regar_Zona_3
- automation.Regar_Zona_4
Rega do jardim:
view: yes
name: Rega do Jardim
entities:
- group.switch_rega
- group.scripts_rega
- group.automacoes
E pronto, espero que vos seja util.