SwitchBot in Openluup (was: Smaller and local alternative to MicroBots)
-
Yep, swichbot seems to be a viable solution. Local control is possible via bt. I'll order one and try it. Unfortunately I can't change the button.
-
@sender said in Smaller and local alternative to MicroBots:
but I use D1 mini and flash with tasmota via "tasmotizer"
I have many of them across the house, mainly to get fancy sensors (distance, humidity, light, pressure, etc), and I integrate them with my own MQTT to luup bridge, plus my virtual plugins.
Anyway, this is an appliance I can't hack at the moment, since it's still under warranty. I've ordered two and will try to integrate via BT. SwitchBot has an open BT API, documented and supported by Home Assistant, so it should be easy to just get the script and replicate it with some luup calls or whatever I'll come with
-
So, I received my units and start thinkering. So far, one is in place, while I need to build a support for the other.
Code is just a small node js app I built around a node library. Seems to work, and I'll report more in the future. Too bad the official hub has no local apis. I can't understand why smart people don't realize internet is not a available everywhere as in their offices... -
People don't learn fast enough. I have seen this being a larger contributor to the bankruptcy of so many startups.... Great/brilliant ideas, destroyed by cloud dependance and the cost/reliability problems/complexity it involves eventually signifying the end of the project and a lot of products dumped in the garbage or best case, a lot of customer frustration. You can probably send them the feedback to let them know...
-
Low cost of entry.
(Quiet innit?)
C
-
@CatmanV2 said in Smaller and local alternative to MicroBots:
Quiet innit?
Decidedly.
No news is good news?
-
therealdbwrote on Aug 15, 2020, 8:36 AM last edited by therealdb Sep 21, 2020, 6:50 AM
So, mission accomplished. I wrote a very basic node app running on my Linux box. I'm using this library because I'm more comfortable with Javascript than Pyton: https://github.com/futomi/node-switchbot
But it's missing the ability to use password protected SwitchBots, so I will probably patch it or move to the Python one, depending on how many spare time I have in the coming weeks.
Node server is very simple:
const http = require('http'); const url = require('url'); const Switchbot = require('node-switchbot'); const requestListener = function (req, res) { const queryObject = url.parse(req.url, true).query; res.writeHead(200); let device = null; if (queryObject == undefined || queryObject.id == undefined) return res.end('Please specify an id'); const switchbot = new Switchbot(); switchbot.discover({ id: queryObject.id, quick: true }).then((device_list) => { if (device_list == undefined || device_list.length == 0) { console.log('#device: notfound'); res.end('no device'); } device = device_list[0]; console.log('#devicefound: ' + device.modelName + ' (' + device.address + ')'); return true; //device.connect(); }).then(() => { console.log('#device:press'); return device.press(); }).then(() => { console.log('#device:waiting'); return switchbot.wait(1000); }).then(() => { console.log('#device:disconnecting'); return device.disconnect(); }).then(() => { console.log('Done.'); res.end('OK!'); }).catch((error) => { console.error(error); res.end('error: ' + error); }); }; const server = http.createServer(requestListener); server.timeout = 5 * 1000; server.listen(5002); console.log('#http:started');
just call http://ip:5002/?id=mac and you're good to go. I just used my virtual device plug-in to have two virtual switches. It's already integrated into Alexa, WAF is high. Another thing removed from my long standing TODO list
-
Ok, must say. Before I was using tasmota. But since I discovered esphome.io that is now my primary start for automation devices. So easy, so cheap and so reliable!
Easily manageable via home assistant addon... -
senderreplied to therealdb on Sep 23, 2020, 8:37 PM last edited by sender Sep 23, 2020, 4:39 PM
@therealdb using esphome and in my case together with homeassistant make mqtt hassle unneeded. It automatically includes the homeassistant api. If the esphome device is part of the same subnet it is auto discovered and entities are auto populated in hass. If not in same subnet need to manually add an esphome integration per device (ip address). Other thing you need to take care of then it is "pinging" devices instead of mdns (all in manual but good to know) for "online status". I have in 1 week around 15 wifi D1 minis as sensors, nextion displays (touchscreen "wallmote quad" but cheaper and better), 4 and 8 relay boards for sprinkler, etc etc. So easy!
-
Yep, I underestimated those cheap wifi devices, until I started to buy many of them, just for testing. While I prefer Zwave for "serious" work, since I have 3 access points on my home (and one outside), Wifi coverage is really good and their traffic is very low anyway, so I'm somewhat sold, especially for fancy sensors and/or difficult to reach zones for my Zwave mesh.
-
@therealdb Thanks for the write up. I managed to setup it up with the Bot and is working. Now I just have to figure out how to write a .py and use mqtt to send the battery status over to Home Assistant.
The Switchbot Curtain is available. Do you think this will work as well? Atm, home assistant does not support the curtain.
-
I’m updating the battery to luup, so it should be doable. I think you may do the same for ha.
The curtain is supported, so this should be easily implemented.
-
@therealdb Thanks for the reply. Would you mind writing up commands for open and closing of curtain? I am not familiar with this code.
-
This js lib doesn’t support curtains bots, but there are Python based one that I do. I don't have one to test, so I'm not sure how well they'll work.
It seems to be natively supported from home assistant. -
Someone over there has tried adding the curtain with the switchbot integration, but it does nothing. No response.
-
I don't have curtains (new, modern house, so zero classic curtains), and I don't use HA anymore, but it seems there are not public API for curtains. try to ping SwitchBot directly and ask for guidance.