Switchmate Switch Covers

Thank you for your prompt reply.

How well does this product work I have basement lights that are not standard light bulbs so smart bulbs are out of question and I do not want to change fixtures. Also I have no common wires so smart switches are out of question. I came accross these and looks like a good solution but donā€™t want to move fwd if they do not work well with HA.

In my experience, Iā€™d pass on these. They arenā€™t very reliable in HA. I have mine set up with a Wink hub, but Wink no longer supports them due to some misunderstandings between the two companies and from my dealings with Switchmate, they arenā€™t doing much if anything to integrate with other products. Itā€™s too bad, because if they really wanted to, it could be a decent product.

Do you mind making a simple guide how to get this working with Hass on a pi3 for a noob? Thanks

I think I got this going so I want to share this with all the users of this product

Step 1: Make sure you install Home Assistant on top of something like Raspbian. Donā€™t use Hass.io(as cool as it is) The manual install procedure worked for me on my Raspberry Pi 3 :
https://www.home-assistant.io/docs/installation/raspberry-pi/

Step 2: Install the modules needed in the python virtual enviorment where Home Assistant is installed.
The steps are as follows:

sudo su -s /bin/bash homeassistant
cd /srv/homeassistant
python3 -m venv .
source bin/activate
pip3 install tabulate
pip3 install bluepy
pip3 install docopt

Step 3:
Install switchmate.py via git - git clone git://github.com/brianpeiris/switchmate.git

Step 4:
Install the latest firmware update from SwitchMate on the device to allow the script to work. Version 2.99.18 appears to work for me.

Step 5:
Use the switchmate.py script to find the mac address of the device

sudo python3 switchmate.py scan

Step 6: Add the following to your configuration.yaml file.

switch:

  • platform: command_line
    switches:
    light:
    command_on: /switchmate/switchmate.py yourmacaddress none switch off
    command_off: /switchmate/switchmate.py yourmacaddress none switch on

I think my switch was on backwards but it works.

This appears to fix the issue for me. Hope it helps

Hey Dwanelarose, thanks for posting these instructions. I was doing great until step 5, where I couldnā€™t sudo in the python venv. I have no idea what the password is for sudo in the venv, after having followed the manual install procedure.

That, and the location for configuration.yaml in the manual install, and I almost have this working. I have 4x switchmate that I used to have working in homebridge, but that plugin no longer works for homebridge, so my plan is to get them working in HA, and then run the HA->homebridge plugin.

Looks like is not going to be an issue anymore!

Does anyone have the new platform working? I have a switch that appears in overview after editing configuration.yaml, but it doesnā€™t actually cause the switch to toggle physically.

Also, any idea how to use that to add multiple switches? Iā€™m not sure of the configuration.yaml syntax to add more than oneā€¦

EDIT: firmware update got 1x switchmate working. Still no idea how to add more than one.

EDIT 2: I got mine working. Yes, I am a newb at HASS. Iā€™m going to leave this here for other people to find. I wish the page at https://www.home-assistant.io/components/switch.switchmate/ had showed how to add multiples.

# Switchmate
switch:
  - platform: switchmate
    switches:
    mac: 'db:1c:7e:........'
    name: 'Front Door'
  - platform: switchmate
    switches:
    mac: 'f3:1a:3e........'
    name: 'Top of Stairs'
  - platform: switchmate
    switches:
    mac: 'f8:f0:e5.......'
    name: 'Living Room'
  - platform: switchmate
    switches:
    mac: 'f1:10:58.......'
    name: 'Kitchen'

Note that the platform lines need to be indented with only 2 spaces.

@vmarks

Works perfectly, Thanks!

I got my switches to show but not sure how to control them. Do I need to do anything other than add the commands to my config.yaml file? Meaning, do I need to go through all the previous steps with bluepy and docopt?

Thanks

Nevermind lol. I just did as you suggested and upgraded the firmware. Then removed the light from the app. Then reloaded home assistant server and it works fine.

Thanks

1 Like

Awesome. Iā€™m so glad you got it working.

Mineā€¦ I came back to my house after being away for a day, and the HASS had forgotten one of the switchmates. I had to reboot the Pi to get it to come back. Weird, because all the others worked.

This is so unreliable. When I rebooted, it picked up the missing Switchmate, but has now forgotten the WeMo Mini I have.

Hey, if anyone knows how to make these show up as lamps instead of switches, that would be awesome.

Turns out mine is doing the same thing. It only remembers one of my switchmate switches. Iā€™ve tried time and again but after each reboot it only picks up one. I wonder if the switch is the culprit?

Did you ever get yours to consistently show both switches simultaneously?

Just curious, what Switchmate hardware is required to get the HA component working? Do you just need one of the switches, or also the Power Outlet or Zip? What protocol does it use? (bluetooth?) What hardware is required in the computer/device running HA? (again bluetooth?) Whatā€™s the range/distance?

Thanks!

Answered my own question by searching. Found this thread. Switchmate platform requires Bluetooth?

How are people finding the reliability of switchbot?

Iā€™ve had mine set up for a couple of days now and it seems really hit and miss! My rPi is located about 3 feet away from the bot, so signal shouldnā€™t be an issue?!?

Iā€™m getting these errors:

Log Details (ERROR)
Tue Jan 15 2019 10:20:51 GMT+0000 (Greenwich Mean Time)

Failed to connect to switchmate
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/switchbot/__init__.py", line 45, in _sendpacket
    hand_service = self._device.getServiceByUUID(UUID)
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 447, in getServiceByUUID
    rsp = self._getResp('find')
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 369, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 326, in _waitResp
    raise BTLEException(BTLEException.DISCONNECTED, "Device disconnected")
bluepy.btle.BTLEException: Device disconnected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/switchbot/__init__.py", line 36, in _connect
    bluepy.btle.ADDR_TYPE_RANDOM)
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 353, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 402, in _connect
    "Failed to connect to peripheral %s, addr type: %s" % (addr, addrType))
bluepy.btle.BTLEException: Failed to connect to peripheral FE:F9:C3:5F:8F:F6, addr type: random

Log Details (ERROR)
Tue Jan 15 2019 10:20:51 GMT+0000 (Greenwich Mean Time)

Cannot connect to switchbot.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/switchbot/__init__.py", line 45, in _sendpacket
    hand_service = self._device.getServiceByUUID(UUID)
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 447, in getServiceByUUID
    rsp = self._getResp('find')
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 369, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python3.6/site-packages/bluepy/btle.py", line 326, in _waitResp
    raise BTLEException(BTLEException.DISCONNECTED, "Device disconnected")
bluepy.btle.BTLEException: Device disconnected

SwitchBot is a different product by a different company than Switchmate, and uses a different integration.