WIFI Button --- for £2.35

I’ve been using the amazon Dash buttons with DASSHIO for quite a while now and they work excellently. However I thought I would like to make my own version:-

Requirements:
ESP01 module — £1.18
AMS1117 power regulator – £0.15
Momentary switch —£0.02
‘Poundland’ power bank (18650 1200mA rechargeable battery) — £1

I used the code from here, MQTT window sensor :-
[https://www.youtube.com/watch?v=BoYVr2UwWWg&t=167s 1st video
https://www.youtube.com/watch?v=2kLZ7DlP9KU&t=77s 2nd video
https://www.youtube.com/channel/UC2gyzKcHbYfqoXA5xbyGXtQ The Hooked UP channel

And replaced the reed switch for a miniature momentary switch.

Put the whole lot inside the ‘power bank’ (ESP01 fits perfectly) and then added some code into HASSIO to interact via MQTT.

wifi%20button

Configuration.yaml

## WIFI IOT Button
  - platform: mqtt
    name: "wifi_IOT"
    state_topic: "wifi_button_1"
    
    
input_select:
  wifi_button_1_mode:
    name: WIFI Button mode
    options:
      - "Bedroom Light"
      - "Computer Light"
      - "Dinning Room Light"
      - "Outside Lights"
      - "Lights off"
      - "Holiday mode"
      - "Movie time"
    icon: mdi:target

panel_LI

Automation.yaml

- alias: WIFI IOT Button
  hide_entity: true
  trigger:
    platform: state
    entity_id: sensor.wifi_iot
    to: "connected"
  action:
    service: homeassistant.toggle
    data_template:
      entity_id: >
        {{ {'Computer Light': 'switch.computer_lamp',
            'Dinning Room Light': 'switch.dinning_room',
            'Outside Lights': 'switch.outside_lights',
            'Bedroom Light': 'switch.bedroom_lamp',
            'Holiday mode': 'group.holiday_mode',
            'Movie time': 'group.movie_time_card',
            'Lights off': 'script.lights_off'
            }
           [states('input_select.wifi_button_1_mode')] }}

(thanks to ‘pnbruckner’ for help sorting template).

Now the powerbank can be used normally, with the benefit of associating various actions to the button to control things (via HASSIO frontend).

The ESP01 uses a small amount of power when you push the button, but as soon as you let go it completely turns off… using no power. This has the disadvantage of taking a few seconds to connect to the wifi when pressed.

The powerbank is rechargeable so this wifi switch should last forever (within reason) and can be made to control whatever you want easily.

13 Likes

Looks good, might use these for my front door. As i don’t really have a need for window sensors.

How long have you been using it ?
How long has it lasted ?

Hi, been using for a couple weeks now and it works flawlessly (famous last words), ongoing testing to see how many pushes i get from one charge, expecting this to be well into the hundreds (seeing as the ESP only takes power for approx 3 seconds at a time, then turns completely off) if not more… with the benefit that once it’s flat I just recharge via usb.

Yep, i was thinking i could just hard wire to a 13650 cell, as i have 10 just sitting around.
But as you said for a pound you get the charge control circuit and a case to stuff it in !

Sorry to bug, did you hook the esp up to the USB output on the powerbank, or direct to the cell ?

direct to the cell, I know it’s 3.7V but all works fine, just don’t push the button while recharging as this will exceed the ESP input voltage during charge mode… what I think I’ll do actually, is to add a little 3.3V regulator to power the ESP this way it won’t matter when you push the button as the ESP is always getting the correct voltage.

I’ve seen ( on bigclivedotcom on youtube ) that some powerbanks won’t turn on or just cut power after a few seconds if the current is to low

I’m curious, I wanted to get a bunch of Dash buttons and you wrote that they worked well for you, what couldn’t they do that you can do with your DIY one?

On eBay I saw they had 15 for 50 bucks with shipping to Europe included, so it’s more or less the same price range…

Don’t get me wrong the DASH button and DASHIO work well.

  1. I wanted to build my own
  2. Mine is not just a wifi button, it’s a power bank with the benefits of having a wifi button
  3. It’s rechargeable
  4. It has nothing to do with the outside world, it’s fully under my control
  5. The button can be associated with whatever you choose via the frontend, (maybe DASHIO can do this, not sure)
2 Likes

not encountered that problem, the ESP01 takes about 70mA so its a sizeable amount of current.