Boas malta, á uns tempos a atras encontrei este tutorial do @RodolfoVieira e achei interessante. Entao meti mãos a obra e nasceu este projecto.
Entao comecei por fazer o que aqui o nosso amigo @RodolfoVieira partilhou.
De salientar que só consegui flashar o wemos com o tasmota 6.4.1 (não sei explicar o porquê)
Então como tenho um comando da logitech Harmony one decidi fazer umas brincadeiras em que com este comando consigo acender/apagar as luzes do tecto e candeeiros da sala assim como dos quartos, fechar/abrir o portão de entrada, abrir/fechar estores. Para isso usei o seguinte código
homeassistant:
###############################################################################
# #
# A U T O M A Ç Õ E S #
# #
###############################################################################
automation:
- alias: Acender apagar tecto sala
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF02FD" }}'
action:
service_template: >
{% if is_state('switch.shelly_sala', 'off') %}
switch.turn_on
{%- elif is_state('switch.shelly_sala', 'on') -%}
switch.turn_off
{% endif %}
entity_id: switch.shelly_sala
- alias: Acender apagar tecto mafalda
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF33CC" }}'
action:
service_template: >
{% if is_state('switch.shelly_mafalda', 'off') %}
switch.turn_on
{%- elif is_state('switch.shelly_mafalda', 'on') -%}
switch.turn_off
{% endif %}
entity_id: switch.shelly_mafalda
- alias: Abrir fechar portão grande
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF9768" }}'
action:
- service: switch.toggle
data:
entity_id: switch.abrir_portao_grande
- alias: Abrir fechar portão pequeno
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF5BA4" }}'
action:
- service: switch.toggle
data:
entity_id: switch.abrir_portao_pequeno
- alias: Abrir fechar portão pequeno metade
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF8679" }}'
action:
- service: script.turn_on
data:
entity_id: script.portao_30
- alias: Acender apagar apliques
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DFE01F" }}'
action:
service_template: >
{% if is_state('group.lampadas_da_sala', 'off') %}
light.turn_on
{%- elif is_state('group.lampadas_da_sala', 'on') -%}
light.turn_off
{% endif %}
entity_id: group.lampadas_da_sala
- alias: Estores em modo TV
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF738C" }}'
action:
- service: cover.set_cover_position
data:
entity_id:
- cover.estore_sala
- cover.estore_mafalda
position: 22
- alias: Fecha Estore Mafalda 50
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF609F" }}'
action:
- service: cover.set_cover_position
data:
entity_id: cover.estore_mafalda
position: 63
- alias: Fecha Estore sala 50
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF827D" }}'
action:
- service: cover.set_cover_position
data:
entity_id: cover.estore_sala
position: 63
- alias: Abrir Estores
initial_state: true
trigger:
platform: mqtt
topic: tele/wemos/RESULT
condition:
condition: template
value_template: '{{ trigger.payload_json.IrReceived.Data == "20DF8E71" }}'
action:
- service: cover.set_cover_position
data:
entity_id:
- cover.estore_sala
- cover.estore_mafalda
position: 100
Agora deixo-vos umas imagens do meu projecto.
Espero que gostem desta partilha e que vos puxe pela vossa imaginação.