Milfra MFA05: Difference between revisions

From Leo's Notes
This page was last edited on 25 November 2022, at 06:13.
No edit summary
No edit summary
Line 27: Line 27:


* https://templates.blakadder.com/milfra_MFA05.html
* https://templates.blakadder.com/milfra_MFA05.html
*https://blakadder.com/pir-in-tasmota-integration/

Revision as of 06:13, 25 November 2022

The Milfra MFA05 is a smart light switch with a built-in motion sensor.

Hardware

This unit's front metal plate isn't properly grounded out of the box due to a design flaw. There is a tab that connects this metal plate to the ground trace on the PCB. However, this tab doesn't extend far enough to make contact with the ground trace. This can be fixed by opening the unit and bending the tab.

Tasmota

This unit is based on a ESP8266 and supports Tasmota. Flashing Tasmota can be accomplished using a USB UART and the exposed headers on the back of the PCB. The 3.3v rail, ground, TX and RX are all labeled as V, G, T, and R, respectively. The button is connected to GPIO 0 so you can hold the button down to enter programming mode during a reset.

Configuration

The template for this unit is available at https://templates.blakadder.com/milfra_MFA05.html. The PIR sensor is set as switch 1. In order to make the PIR work with Home Assistant, you will have to additionally run the following commands after setup in Tasmota's console These commands decouple the switch from the relay, creates a rule to publish the PIR event as a motion detector, and publishes the auto discovery info to Home Assistant on startup..

Note that I use tasmota/%topic%/%prefix%/ as the MQTT full topic on my devices (the topic and prefix are in reverse order than the default). You will have to adjust this depending on your setup.

SetOption114 1

SwitchMode1 1
SwitchTopic 0
Rule1 on Switch1#state=1 do publish tasmota/%topic%/stat/PIR1 OFF endon on Switch1#state=0 do Publish tasmota/%topic%/stat/PIR1 ON endon
Rule1 1

rule2 on system#boot do publish2 homeassistant/binary_sensor/%macaddr%_motion/config {"name":"Motion Sensor","state_topic":"tasmota/%topic%/stat/PIR1","device_class":"motion","force_update":true,"off_delay":30,"availability_topic":"tasmota/%topic%/tele/LWT","payload_available":"Online","payload_not_available":"Offline","unique_id":"%macaddr%_motion","device":{"connections":[["mac","%macaddr%"]]}} endon
rule2 1

See also