Switch Bot

What did you do with the password. I’m struggling to get the switchbot working at the moment. Thats the reason why I ask.

I just remove the password I setted to the hub in Switchbot app for android.

Thanks for the answer. After I can’t get it running and due to the fact that i am using also other switchbot devices i use IFTTT now. With IFTTT I can control everything as I want with webhook automations. Also switchbot hub integrations work fine. :slight_smile:

Does any Switchbot owners (who don’t use the hub) can tell me if Lovelace UI will show me if the Switchbot is in On or Off status? I simply want it to just control a single light switch in the kitchen. But I want to know from looking at the Home Assistant UI that’s Switchbot status is in On or Off status.
Thanks

@ jellytotz

If you are referring to the switchbot bot, it gives you the states on or off. The issue with this is that if someone manually turn on/off the device. The state HA says will not be accurate. Furthermore, when HA reboots, it reverts to off.

With that said, you can create a switch to retains it’s states when HA reboots using an input_boolean. This is how I did to one of my bots. My bots is controlled via shell command. I believe it will work with a switch as well. You can use it as a guide and tweak to your setup.

input_boolean.yaml

  washroom_fan:
    name: Washroom Fan
    icon: mdi:fan

shell_command.yaml

  24hr_fan_bot: 'curl -k "http://192.168.1.30:5004/?id=fab50h9b504e&cmd=press"'

switch.yaml

  - platform: template
    switches:
     24hr_fan:
       friendly_name: '24hr Fan'
       value_template: "{{ states('input_boolean.washroom_fan') }}"
       turn_on:
         - service: shell_command.24hr_fan_bot
         - service: input_boolean.turn_on
           entity_id: input_boolean.washroom_fan
       turn_off:
         - service: shell_command.24hr_fan_bot
         - service: input_boolean.turn_off
           entity_id: input_boolean.washroom_fan
       icon_template: >-
         {% if is_state('input_boolean.washroom_fan', 'on') %}
           mdi:fan
         {% else %}
            mdi:fan-off
         {% endif %}

1 Like

Hello,

I’ve some switchbot thermometer and a switchbot hub min.
Can anyone explain me how to make the integration of these without IFTTT?

I’m realy lost…

THX

Hey guys,

I have a HA VM with no BT, can I use this though the hub?

I believe you can use switchbot api. Request API token via the feedback within the mobile app.

There is no integration though, someone would need to make it?

This is how I do it. It’s all local without using the cloud API, which didn’t exist at the time. It also doesn’t need the hub, but you can keep it if you still want to be able to see your Meter in the Switchbot app.

Here is a very detailed video covering how to set everything up, starting from 3:04.

1 Like

Thanks for that,

My issue is though I run HA through a VM with no BT.

At the moment, I have have the devices coming through to HA via SmartThings integration. But just makes it hard to get rid of SmartThings (its pretty much dead anyway lol)

Ill have to think about it

A VM without Bluetooth is no problem with this method. You use a separate device like a Pi Zero W to sniff BLE and publish MQTT messages for your HA instance.

Depending on your host set-up, you might be able to run sbm2mqtt on the host system of the VM instead of on a separate machine, assuming it’s Linux. Some people run it under Ubuntu.

Ok, that’s interesting… Maybe finally a use for the 5 or so Pi Zeros I have haha.

So basically install This on the Pi and point the home assistant MQTT broker to it?

checkout my code for esp32. all the work is done by esp32 to convert mqtt to switchbot bluetooth and back to mqtt response. Zero failures over the past week. you can add as many esp32s around the house to get maximum coverage

Yes, that’s right. I’ve tested it with four Meters. You’ll have to do something else for for button presser, though.

2 Likes

I’m trying to figure out the options to have the Switchbot Bot get triggered. Any thoughts around this? I have the same HA setup in a VM with no Bluetooth.

I do have a spare Pi lying around that I could setup to script, but would like it controllable eventually in HA even if it went over MQTT.

Just wondering how you had gotten the ID of the bot that you use within your CURL shell script

@ damonizer
Hi. I am using node.js to control the bot. You can find some info here and how I set it up. You will need an extra rpi at the least for this. I used a rpi zero w.

Hi
i used your code to do the multiple consecutive clicks part for my switchbot but i can’t get it to work

Hey there,

I have also 2 ps of switchbot. I have those intergrated in my Home assistant an i can see the status of my curtains off the are open or closed. So i also intergrated mij BLT MAC in my config, but i stil cant controll mij curtains. When i press open or closed there is nothing happend. Is here somebody how knows what it can be?

Thanks.