Sonoff Smart Garage

My Sonoff Smart Garage

I wanted to explore setting up one of my garages using the Sonoff SV which was inspired by a YouTube video from DrZzs (https://youtu.be/QMepwpyjMCY).

This project was an attempt to enable my garage to work with Home Assistant using MQTT. I tried out the Sonoff SV for my first time use of that model on something practical and could benefit from the relay switch built-in.

smart_garage_01

Figure 1.1 – View of the first Sonoff SV implementation using a magnet reed switch.

 

1. My Amazon Gear

2. Tools and Software

Documentation for building the Garage “Smart”

 

3. Sonoff Build

I recently upgraded to the latest Sonoff-Tasmota 6.4.1 which includes integration with Home Assistant – keep it in mind it will change the publish and subscribe settings. I also opted to allow the Sonoff rules to turnoff the relay after 1 second rather than via MQTT in Home Assistant.

If using a Mini USB to flash like I am, then you will need to install CP210x USB to UART Bridge VCP Drivers from – https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

IMG_0812

4. Run the following Sonoff Post-Commands:

Assuming you already connected to WiFi at this point. The following commands were used after flashing the Sonoff SV (6.4.1). I created a rule from having to require an outside process to turn off the relay (which worked in Home Assistant).

Note: Always best practice to set a static IP at the router for this device.

  1. Backlog SwitchMode1 0;SwitchMode2 2;Switchretain 1;Powerretain 1;switchtopic2 garagestate
  2. rule1 on Power1#state=1 do backlog power1 1; ruletimer1 1 endon on rules#timer=1 do power1 off endon
  3. rule1 1
  4. SetOption19 1
    1. This enables Home-Assistant automatic discovery and creates the mqtt structure for hassio
  5. SetOption19 0
    1. This disables Home-Assistant automatic discovery as I chose to use custom mqtt sensors – just wanted to match the same structure as other devices without auto discovery involved
  6. SetOption30 0
    1. Zero (0) will Automatic announcement as ‘switch’ for relays and ‘light’ for PWM in Home-Assistant MQTT discovery message.
    2. One (1) will Enforce Home-Assistant discovery as ‘light’ platform also for relays

Diagram of pre-production Go-Live

garage_floorplan_testing

img_0819

Hassio (Home Assistant) Installation

Following the instructions here.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: