Smart Motion Sensor and Night Light - How To



How to make a Smart Motion Sensor out of a Night Light Smart Plug.  An excellent solution to easily put a motion sensor in a room where you couldn't before for automated lights. You also get a night light and smart plug in the same package for less than $20!

Parts List
Smart Plug - iMah or iClever 
PIR Motion AM312 Sensor - 2 pack or 1 pack 

Soldering Iron Station
Helping Hands(as shown)
Better Helping Hands
0.015 Solder
Female Jumper Wires
USB FTDI for Flashing



(click the pic to zoom)




Home Assistant Configuration YAML - Samples

switch:
  - platform: mqtt
    name: "MotionNite Switch"
    state_topic: "stat/MotionNite1/POWER1"
    command_topic: "cmnd/MotionNite1/POWER1"
    availability_topic: "tele/MotionNite1/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

binary_sensor:
  - platform: mqtt
    name: "MotionNite PIR"
    state_topic: "MotionNite1/PIR"
    availability_topic: "tele/MotionNite1/LWT"
    qos: 1
    payload_on: "1"
    payload_off: "0"
    payload_available: "Online"
    payload_not_available: "Offline"
    device_class: motion

light:
  - platform: mqtt
    name: "Motion Night Light"
    state_topic: "stat/MotionNite1/POWER2"
    command_topic: "cmnd/MotionNite1/POWER2"
    availability_topic: "tele/MotionNite1/LWT"
    brightness_state_topic: "stat/MotionNite1/RESULT"
    brightness_command_topic: "cmnd/MotionNite1/Dimmer"
    brightness_scale: 100
    brightness_value_template: "{{ value_json.Dimmer }}"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. Travis, Great video. I bought 2 of the plugs and am in the process of doing the project. I googled the pinout of the TYWE3S it seems that the pins on my drawing are flipped as compared to yours. With the WiFi antenna pointing to the right and being able to read the label on the chip, GND is on the top and to the far left, VCC in on the bottom and to the far left, Rx and Tx are on the top and to the far right. Is my drawing wrong ?????
    Mike
    MikeKendig@comcast.net

    ReplyDelete

Post a Comment

Popular posts from this blog

Smart Laundry Notifications with a Sonoff S31 & Home Assistant

Part 1 - How to Expand Tasmota/Sonoff Devices with the I2C Protocol - I²C