Posted on

Creating a perimeter alarm (pool fence) using a Sonof Basic unit

Credit: Patrick Schutte

I wanted to create the ability to be aware when there could be someone or children close to my pool area. A rough sketch of the area in question is outlined below.

I set up the dual beam unit as shown above. With the distance to the Sonof basic unit being about 20+ metres, I could not simple connect directly to the Sonof unit which works with 3.3 volts. The easiest was to connect the relay from the perimeter sensor to 12 volts as well and drive a 12 volt relay mounted on the Sonof basic unit, this should ensure no false alarms or attenuation on the line.

For my purposes, I wanted to be able to activate and de-activate the alarm when the garden service was here or if we were going to be using the area.

Preparing the Sonof Basic unit

In the photo above, I have brought out all 5 wires for potential future expansion. I have glued the 12v relay onto the side for access as well. I am using pin 5(GPIO14) as my sensor which goes to the NO (Normally Open) pin of the relay, and Pin 4 (Ground) to the common of the relay.

The pinout details for the Sonof basic can be accessed at https://github.com/arendst/Sonoff-Tasmota/wiki/GPIO-Locations


Configuring the Sonof unit.

The Sonof unit is flashed with the Tasmota MQTT software, and configured as below:

By using switch 2 as the sensor, I can control when the unit gets switched on or off. If I had used switch 1, it would switch the unit on at the same time when activated.

You then go to the console, and enter switchmode2 4 this effectively sets the mode to toggle between on and off.

Configuring in Home Assistant.

In my sensors.yaml file, I added:


# MQTT binary sensors
- platform: mqtt
name: Pool Alarm
state_topic: "cmnd/poolfence/POWER2"
payload_on: “ON”
payload_off: “OFF”

In my switches.yaml file, I added:


- platform: mqtt
name: "Pool Siren"
command_topic: "cmnd/poolfence/power"
state_topic: "stat/poolfence/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true

I needed an indicator to define if the alarm is active or not, so I used the Boolean Input, this I added to my configuration.yaml:


# keep track of pool alarm state
input_boolean:
pool_alarm_active:
name: Activate pool alarm
initial: on
icon: mdi:gate

All we now have to do is define the automations to run it. I needed to be able to switch off the alarm on Thursdays between 7:30am and 10:00am for the garden service. I also have an automation so that the alarm will reset itself after 10 minutes after being activated. Finally, I added in the service to ensure that the alarm is active if we had an evening by the pool and I forgot to re-activate it.

Defining the automations.


#switch off alarm for the garden service.
- id: garden_service_arrive
alias: Garden Service Arrive
trigger:
- platform: time
at: '07:30:00'
condition:
- condition: time
weekday:
- thu
action:
entity_id: input_boolean.pool_alarm_active
service: input_boolean.turn_off

#switch on alarm after the garden service leaves.
- id: garden_service_leave
alias: Garden Service Leave
trigger:
- platform: time
at: '10:00:00'
condition:
- condition: time
weekday:
- thu
action:
entity_id: input_boolean.pool_alarm_active
service: input_boolean.turn_on

#switch on alarm if switch2 (GPIO14) is toggled.
- id: pool_alarm_triggered
alias: Pool Alarm Triggered
trigger:
platform: state
entity_id: sensor.pool_alarm
to: 'ON'
condition:
- condition: state
entity_id: input_boolean.pool_alarm_active
state: 'on'
action:
entity_id: switch.pool_siren
service: switch.turn_on

#switch off alarm and reset Switch2 state.
- id: pool_alarm_reset
alias: Pool Alarm Reset
trigger:
platform: state
entity_id: sensor.pool_alarm
to: 'ON'
for:
minutes: 10
action:
- service: switch.turn_off
entity_id: switch.pool_siren
- service: mqtt.publish
data:
topic: 'cmnd/poolfence/POWER2'
payload: 'OFF'
retain: 'true'

#switch on outside lights and reset pool alarm
- id: sunrise_routines_2
alias: Sunrise Outside Lights On
trigger:
- platform: time
at: '04:30:00'
action:
- service: light.turn_on
entity_id: light.outside_light
- service: input_boolean.turn_on
entity_id: input_boolean.pool_alarm_active

GUI Display

At this stage, I have not made my screens ‘pretty’ yet. On my GUI screen, I get the Switch2 displayed as Pool Alarm.

The Siren switch:

The Boolean input to activate and de-activate the alarm, as well as the various automations:

I hope this helps others to expand the use of their Sonof Basic units.

DISCLAIMER: Please ensure that your Sonof unit is disconnected from power before opening the unit up. There are dangerous voltages inside and if you do not know what you are doing, please get a qualified person to assist you.

Posted on

Using the Sonoff SV with a relay to open/close gate remotely

12V + and – (from the gate motor supply) to the sonoff + and – power input
sonoff SV output (+ and -) to relay input
relay output (NO contact) to gate motor trigger contacts

The relay can easily be purchased at Communica, Mantech or similar for about R10 a piece This will require some basic soldering skills and a bit of time (approximately 10 minutes I would say).

Please note: the end user accepts full responsibility for death, injury or damage to property when following the above instructions.

Posted on

Instructions for flashed devices

To access your Tasmota device either:

  • Create a WiFi hotspot on your smart device with the SSID “smartkit” and password “password” (no quotes); find the device IP; enter the IP in the smart device browser; change your WiFi settings
  • Start Wifi smartconfig, with 3 short presses, allowing for SSID and Password configuration using an Android mobile phone with the ESP8266 SmartConfig app. The LED will blink during the config period. A single button press during this period will abort and restart sonoff.
  • Put the device in WiFi manager mode with 4 short presses – you should then see an SSID of Sonoff-xxxx; connect to Sonoff-xxxx; enter 192.168.4.1 in your browser; change your WiFi settings
  • Start Wifi Protected Setup (WPS), with 5 short presses, allowing for SSID and Password configuration using the router’s WPS button or webpage. The LED will blink during the config period. A single button press during this period will abort and restart sonoff.
Posted on

Sonoff S26 WiFi Smart Plug – EU

S26

Sonoff S26 is a WiFi smart plug with EU standard. Users can instantly convert any plug into a smart outlet with a convenient timer function that works on the user’s smartphone. With this smart socket, you can turn on and off any connected device – either via the eWeLink app or by pressing the manual control knob of the WiFi plug. It allows you to set countdown/schedule/loop timers to auto-turn on or off the WiFi controlled outlet via the app. You can share the WiFi plug with your family so that you can all control the device. Just plugin and take a minute to setup – you’ll be able to control your lighting and home appliances from anywhere, at any time.

Buy now »

Posted on

Introducing the Sonoff iFan02

iFan02

Convert Any Non-smart LED Ceiling Fan to WiFi Smart Ceiling Fan with Light

Sonoff iFan02 is a driver for ceiling fans with lights. By replacing the old driver with the iFan02, your non-smart LED ceiling fan will be converted to a smart ceiling fan. It allows you remotely control the ceiling fan, with LED light, via the eWeLink app. You can turn the fan on and off, turn the light on and off, change the fan speed and the light’s colour.

Buy now »

 

Posted on

Preparing my Christmas

Well I wasn’t expecting it to be this year but the time has come. This year I will be spending Christmas at my new home in Copenhagen with Stephen and Hansel and not with my family in the UK (eek, feeling slightly guilty). At the age of 34, I will be cooking Christmas dinner for the first time! Hence prepping for my Christmas table. Usually I’m the helper but now I’m the hostess! (eek again).

I’m not the best chef but I’ll give a good try. The fun part for me is planning my decor and the dining table. And not one for Christmas cliches. I like to keep my decor understated, humble with hints of nature, raw materials and simplicity. This may not feel too Christmassy but it is a start. I’ll be looking to add a few more pieces (maybe a wreath), candles and a good bottle of red wine. Then I’ll attempt the food……

This story was originally published at hannahinthehouse.com 

Posted on

Music to your ears

Once a lounger, always a lounger. Last week I had the perfect opportunity to try out a cool chair from Fredericia. The new matt edition of the Stingray rocker chair, a modern classic by Danish designer Thomas Pedersen.

nspired by nature the Stingray rocker chair has large organic forms with a flowing shape of a stingray. This design allows you to sit back and relax in various positions. After styling it in my home and photographing it from every angle, I made sure that I lounged for hours with my feet up (research purposes of course).

Posted on

Scandinavian Style At Home

Truthfully, when I see a “Scandinavian Style” book I can be somewhat dubious of it’s content. Lets face it, there are plenty of books out there that want to be branded Scandinavian because of the popularity but really don’t have a clue. Remember last year when there was a ‘hygge’ book epidemic?! And even then there were writers misunderstanding the concept entirely.

So when discovering a book that is in fact well informed and giving true tips and advice on Scandinavian style, then I think it’s a important that I share! Oh and it’s written by my friend and fellow design blogger Allan Torp from Bungalow 5. yes yes this may seem incredibly biased. Which it obviously is a little but Allan really knows his Scandinavian design! Who better to write this book than international design writer, from Copenhagen, living and breathing Scandinavian style.

The book itself is a thorough room by room guide to achieving the Scandinavian style, with description on colours, favourite pieces and how you with easy steps can live like a real Scandinavian. Part of the book is also a whole genesis of this design phenomenon. – says Allan

Going through Scandinavian Style at home, I was actually surprised as I wasn’t expecting it to be like a source book. It’s not even that big but it’s packed with information. There are room by room guides, case studies, product design details and practical tips too. I’ve found it to be a book that I keep on picking up. A great source of inspiration!

A little about Allan Torp……

This story was originally published at hannahinthehouse.com 

Posted on

House Tour | Natural and neutral. A beautifully styled Danish home dressed for Christmas

Bringing nature indoors is special all year round,this can be neglected during the winter months. As usual I am always inspired by the scandinavian balance of design, nature and style, when this style used for Christmas it looks amazing.

I found this fabulous North Copenhagen home on Femina, the house tour is stunning, The home owners are Camilla Thomsen, manager of the flower shop LaFleur, and Jens Thomsen, account manager at Fullrate Business. Camilla quoted that she wanted decorations from the garden with bare branches, pine cones and lots of candles. This style has most definitely been achieved and I just love it!

This story was originally published at hannahinthehouse.com