Part 1
In this first part, you’ll see how to take a NodeMCU + Relay Board, load with Tasmota and wire. We’ll setup MQTT and test in preparation for configuration into Home Assistant.
Part 2
In this second part, I’ll show you how to setup our newly flashed NodeMCU with tasmota into Home Assistant and Node Red.
We’ll configure the entities into our Lovelace dashboard and create a Cover Template combining the switches and sensor to give us full control and visibility.
Links to Products Featured in this video:
Software/Downloads used in Video
Configuration.yaml
switch:
- platform: "mqtt"
name: "Garage Open"
payload_off: "OFF"
payload_on: "ON"
command_topic: "cmnd/nodemcu_garage/POWER1"
- platform: "mqtt"
name: "Garage Close"
payload_off: "OFF"
payload_on: "ON"
command_topic: "cmnd/nodemcu_garage/POWER2"
cover:
- platform: template
covers:
garage_door:
device_class: garage
friendly_name: "Garage Door"
value_template: "{{ states('input_boolean.demo_garage_door')|regex_replace('on','open')|regex_replace('off','closed') }}"
open_cover:
service: switch.turn_on
data:
entity_id: switch.garage_open
close_cover:
service: switch.turn_on
data:
entity_id: switch.garage_close
icon_template: >-
{% if is_state("input_boolean.demo_garage_door", "on") %}
mdi:garage-open
{% else %}
mdi:garage
{% endif %}
Node Red Configuration
[{"id":"11ae10c0.b2bddf","type":"mqtt out","z":"435023c6.752c0c","name":"","topic":"","qos":"2","retain":"false","broker":"feb9c094.c52828","x":830,"y":180,"wires":[]},{"id":"544c1540.fa7c7c","type":"inject","z":"435023c6.752c0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/nodemcu_garage/POWER1","payload":"on","payloadType":"str","x":540,"y":180,"wires":[["11ae10c0.b2bddf"]]},{"id":"df5d171b.7517e8","type":"mqtt out","z":"435023c6.752c0c","name":"","topic":"","qos":"2","retain":"false","broker":"feb9c094.c52828","x":830,"y":220,"wires":[]},{"id":"72382e91.b378e","type":"inject","z":"435023c6.752c0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/nodemcu_garage/POWER1","payload":"off","payloadType":"str","x":540,"y":220,"wires":[["df5d171b.7517e8"]]},{"id":"edb5973c.40b768","type":"mqtt out","z":"435023c6.752c0c","name":"","topic":"","qos":"2","retain":"false","broker":"feb9c094.c52828","x":830,"y":300,"wires":[]},{"id":"34ee4cbe.a20d44","type":"inject","z":"435023c6.752c0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/nodemcu_garage/POWER2","payload":"on","payloadType":"str","x":540,"y":300,"wires":[["edb5973c.40b768"]]},{"id":"771bdbd.4ca3724","type":"mqtt out","z":"435023c6.752c0c","name":"","topic":"","qos":"2","retain":"false","broker":"feb9c094.c52828","x":830,"y":340,"wires":[]},{"id":"d2ea5bc3.187bb8","type":"inject","z":"435023c6.752c0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"cmnd/nodemcu_garage/POWER2","payload":"off","payloadType":"str","x":540,"y":340,"wires":[["771bdbd.4ca3724"]]},{"id":"2956798f.91f036","type":"server-state-changed","z":"435023c6.752c0c","name":"","server":"22f5da40.d3e236","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.garage_open","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":510,"y":480,"wires":[["f5e9d062.85bad"],[]]},{"id":"f5e9d062.85bad","type":"delay","z":"435023c6.752c0c","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":760,"y":480,"wires":[["4022904d.18eb7"]]},{"id":"4022904d.18eb7","type":"api-call-service","z":"435023c6.752c0c","name":"","server":"22f5da40.d3e236","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.garage_open","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":980,"y":480,"wires":[[]]},{"id":"8b73b54f.bcc3a8","type":"server-state-changed","z":"435023c6.752c0c","name":"","server":"22f5da40.d3e236","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.garage_close","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":500,"y":540,"wires":[["db7780e4.99912"],[]]},{"id":"db7780e4.99912","type":"delay","z":"435023c6.752c0c","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":750,"y":540,"wires":[["9f1b559e.9f74a8"]]},{"id":"9f1b559e.9f74a8","type":"api-call-service","z":"435023c6.752c0c","name":"","server":"22f5da40.d3e236","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.garage_close","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":970,"y":540,"wires":[[]]},{"id":"feb9c094.c52828","type":"mqtt-broker","name":"local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"22f5da40.d3e236","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]