User avatar
jbeale
Posts: 3578
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 4:32 am

I see there are now many home automation parts like light dimmer switches that have wifi built in, which are advertised to be compatible with cloud services like Apple Home or Google Alexa. (I think anyway, I don't use either of those.)

I guess that's good for the average consumer, but I would like to be able to control a light dimmer switch that is somehow on my LAN directly from a Python program (say, on a Pi) without going through some complex cloud infrastructure. Are there devices that offer this? What terms should I look for, "wifi dimmer switch with published API" ?

Here's an example of what I don't want- reading the comments it seems the Legrand products "happened to be" compatible with a home automation system but this was apparently by accident due to using a "ARTIK Cloud" service that was accessible to a Samsung hub (?) but some months ago they shut that down and converted to something else, and turns out Legrand has no interest in supporting home automation systems or customers who invested in their stuff for that purpose.
https://developer.legrand.com/forums/to ... artthings/

Maybe the "Insteon" products could work but they apparently need an "Insteon Hub" for another $75 which seems annoying.

"smart dimmer no hub" does give results, but apparently they all work through the cloud and cannot be directly controlled on a LAN without first going through a cloud service (!?)

"cloudless IoT" is a thing, but apparently not much in the consumer space.

"wifi dimmer raspberry pi" gives me a few dev-board prototyping kits, but no finished products.

User avatar
topguy
Posts: 6164
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 2:37 pm

Does it have to be Wifi ? Most of the hardware with bridges uses other wireless communication between the hub and the devices.
If you have a big house, do you really want to have 35 lightbulbs/swithces on you local Wifi ?

By making the Pi your "hub" you would have more options for integration with bluetooth or Zigbee ( with a Zigbee usb-stick in the Pi )
- https://github.com/Koenkk/zigbee2mqtt
- https://joonas.fi/2018/12/17/ikea-tradf ... g-started/

If you want an overview of potential systems I found this: https://www.home-assistant.io/integrations/#light I havent clicked trough them all to see if one fits your requirements.

User avatar
jbeale
Posts: 3578
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 3:34 pm

Thanks for the reply. I saw wifi-enabled switches and dimmers starting around $25 which seemed like a good value, and I know I have a wifi signal into the garage, which is where I want the light (just one, for now). It seems like the hardware should work, but the software isn't designed to be used standalone and needs a cloud service.

I've never used Zigbee but read it has a short range and the Pi I wanted to use to control this is at the extreme opposite end of the house. If that's the only option, I guess I'll be using it though.

Ah, I see there is also another choice "Z-wave" which is more proprietary, but apparently is still usable from a Pi:
https://raspberrypihq.com/how-to-create ... pberry-pi/
Since it operates on the 908.42 MHz band at a lower frequency than wifi, it has potentially better range.
The USB Z-stick controller is not super cheap but it looks like a possibility.
https://www.amazon.com/gp/product/B00X0AWA6E/
The actual Z-wave end devices are reasonably priced
https://www.amazon.com/Z-Wave-Repeater- ... 07VKKT7X7/

EDIT: I see there is a cheaper controller GoControl CECOMINOD016164 HUSBZB-1 that is 2-in-1, offering both Zigbee and Z-wave. So that's interesting! https://www.amazon.com/GoControl-CECOMI ... 01GJ826F8/

Edit2: ...ah, but the GoControl may be discontinued, and it uses an out-of-date Z-Wave SDK. This whole market segment reminds me of the early days of PCs before much standardization. Looks like this controller is more up to date, in the same price range: "Zooz Z-Wave Plus S2 USB Stick ZST10" with several people reporting it works well using Home Assistant on a R-Pi.
Last edited by jbeale on Fri Jan 10, 2020 4:39 pm, edited 5 times in total.

mattmiller
Posts: 2177
Joined: Thu Feb 05, 2015 11:25 pm

Re: Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 3:42 pm

All the commercial products go out of their way to NOT allow direct LAN control by the likes of us.

At what most of us would consider a reasonable price

All solutions to doing this cheaply are bodges and the manufactures work hard to stop the bodges from working

Having said that, they recently said they were going to change their attitude and approach but that time has not yet arrived

The most reliable way to get WiFi devices to work direct in LAN is to reflash the firmware in them to an open source version such as Tasmota.

In most cases this means physically breaking into them (which raises real safety issues)

User avatar
neilgl
Posts: 1396
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 4:53 pm

+1 for Tasmota, though I programmed my Teckin smart switches without physically opening them.

PhatFil
Posts: 1552
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 5:10 pm

+2 for Tasmota, while there are other alt firmware projects for esp826x architecture tasmota is by far the most mature and feature packed.

Its wiki also maintains a pretty good list of suitable devices to use and how to flash them..

https://tasmota.github.io/docs/#/Home

your Pi can host a mqtt broker like mosquitto with a nominal overhead, (i use a pi-0-w...) and you can issue mqtt commands via your own python scripts, or as suggested above use one of the mature home automation suites, or something else for example my modest system is managed with a small collection of node red flows.

User avatar
jbeale
Posts: 3578
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Pi somehow control wifi light dimmer ?

Fri Jan 10, 2020 5:53 pm

Interesting to learn about Tasmota, I see it does support wifi dimmers like "PS-16-DZ" containing ESP8285 and a Nuvoton N76E003, so that's another choice... but once I reflash firmware, I'm completely owning responsibility for how something that in my case could draw 120V * 15A = 1800W is controlled- or not controlled.

By the way, I had to laugh when I saw this "smart home hub" automation product for $120 (and that for an open-box return). I mean, I'm sure it's very capable, but... https://shop.homeseer.com/products/home ... r-open-box

Image

PhatFil
Posts: 1552
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Pi somehow control wifi light dimmer ?

Sat Jan 11, 2020 4:37 am

jbeale wrote:
Fri Jan 10, 2020 5:53 pm
Interesting to learn about Tasmota, I see it does support wifi dimmers like "PS-16-DZ" containing ESP8285 and a Nuvoton N76E003, so that's another choice... but once I reflash firmware, I'm completely owning responsibility for how something that in my case could draw 120V * 15A = 1800W is controlled- or not controlled.
Tasmota wont fail you, your own logic implementation may, and the oem system relying on a dodgy phone app and remote servers that possibly? indulge in data mining probably will.

with the capacity to both add further sensor input to available gpios, And to define and save local rules for execution If you can conceive of an unexpected error condition that would result in an uncontrolled run away 1800w light you can code a counter ;)

ie if you loose wifi coms or the mqtt broker start a 5,10,30 minute timer to turn off the lights unless coms are re established..

there is s/w, a case and a zwave usb dongle involved in that Pi bundle..
I didnt look to see how much the s/w costs on its own??

User avatar
scruss
Posts: 2821
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Pi somehow control wifi light dimmer ?

Sat Jan 11, 2020 4:52 pm

I'm just finding my way around IKEA's Trådfri system (now called IKEA Home Smart but almost all the kit is still labelled Trådfri) and it might be what you need. It's Zigbee, but they do have affordable repeaters (~$10) to extend range. It doesn't expose your home automation to the internet, but it does need a smartphone app to set it up. That app doesn't seem to collect any personal information, but the net connected gateway will update its own and all connected devices' firmware from the IKEA server. Pairing devices can be fiddly: I had to repeat the process several times before it worked. I still don't have my devices appearing as usable in the IKEA Android app, but they do work from the command line.

Note that for dimming, Trådfri can only dim/colour IKEA's own bulbs. The outlet is strictly on/off.

I'm replacing an ancient X10 system (in use with a Raspberry Pi since 2012) with Trådfri. It's a very different approach: Trådfri has security, X10 doesn't. Much of the documentation online regarding Trådfri and Raspberry Pi/python refer to an old version of the Trådfri firmware that no longer works. If you see any guides online about compiling libcoap with tinydtls, those won't work. I've managed to get my devices working with the stock libcoap2 binaries (particularly using the coap-client-gnutls command).

The most helpful breakdown I've found so far about how to talk to the system at low level is this: glenndehaan/ikea-tradfri-coap-docs: How can you communicate to your ikea tradfri gateway/hub through coap-client. Skip the bit about building libcoap: sudo apt install libcoap2 libcoap2-bin libcoap2-dev libcoap2-doc should do that bit. libcoap seems to talk JSON, so you may need to fiddle with that.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

stevend
Posts: 228
Joined: Fri Oct 11, 2013 12:28 pm

Re: Pi somehow control wifi light dimmer ?

Sun Jan 12, 2020 8:05 am

neilgl wrote:
Fri Jan 10, 2020 4:53 pm
+1 for Tasmota, though I programmed my Teckin smart switches without physically opening them.
Be careful if buying Teckin; they've made some changes which make them at best less useful, at worst useless for the likes of us.

User avatar
neilgl
Posts: 1396
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Pi somehow control wifi light dimmer ?

Sun Jan 12, 2020 12:29 pm

Yes that Teckin change is mentioned on the Tasmota forums.

User avatar
scruss
Posts: 2821
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Pi somehow control wifi light dimmer ?

Mon Jan 20, 2020 7:28 pm

I've released scruss/ihsctrl: a package of bash scripts to control selected IKEA Home smart (aka “TRÅDFRI”) devices via their network gateway. It only supports on/off control for now on the IKEA outlets and bulbs. No fancy UX or overarching home control system: just command-line tools to turn lights/sockets on and off remotely.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Automation, sensing and robotics”