Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.27k stars 3.04k forks source link

Integration with Google assistant #31

Open pradhyuman18 opened 6 years ago

pradhyuman18 commented 6 years ago

How can I Control it with Google assistant

Aircoookie commented 3 years ago

@Ryanb58 wow, that is awesome! If you manage to implement something that works, I'd definitely be happy to cover the hosting $ if it's not outrageous.

About MQTT, indeed, it works outside the local network, which I believe is a key requirement for this sort of thing to work. Both the WLED device and your AWS service connect to the public MQTT server (also called broker) via TCP. We can use a general purpose free public MQTT server like broker.hivemq.com for the time being, if this gets big, we can consider hosting our own MQTT broker later.

How it works is also quite simple, the WLED subscribes to the /wled/abcxyz topic (where abcxyz is some unique identifier, currently using part of the MAC address) on the MQTT server and when the AWS service sends a control command to the MQTT broker (called a publish), the MQTT server forwards that to the subscribed client (the WLED device). The most tricky part would be giving the service the correct identifier for the WLED device the user would like to control, so that it can publish to the correct MQTT topic. Maybe for a start, the user would need to fill in the identifier and device name manually in the same place that they authenticate (I'm very sorry, OAuth2 goes a little over my head, got no idea how it works)

Ryanb58 commented 3 years ago

@Aircoookie Are there any plans on supporting TLS 1.2 and x.509 certs during the MQTT rewrite?

Aircoookie commented 3 years ago

@Ryanb58 not currently, on ESP8266 we definitely do not have enought memory for crypto. On 32, it is less of an issue, but it is still quite hard. The only way that worked when I tried it was hard-coding a certificate, which of course breaks all communication if it expires, and only allows interfacing with one specific pre-set server. That said, the connection between MQTT broker and AWS could be configured as TLS/x.509 with relative ease, while still using unsecured TCP between broker and WLED device. It boils down to whether we'd need to send confidential data (e.g. OAuth tokens) over MQTT, I would be very uncomfortable without TLS, but for simple device name/announce/identifier/brightness or color change command types of traffic. It also only applies if we had a dedicated MQTT broker, with a public one, theoretically anyone could mass-subscribe to topics and intercept traffic, even if all transport paths were secured.

Ryanb58 commented 3 years ago

@Aircoookie I played around with MQTT a bit more over this last weekend, and learned a lot. I went through the steps of setting up a local Mosquito MQTT server and controlling my WLED lights from it; from a python script. That gave me a way better understanding of how it operates.

I didn't have to send any OAuth Tokens over the wire to MQTT broker.

If I get some more time this next weekend, I will attempt to push it all onto an EC2 instance and test out my Oauth App's code alongside a dedicated MQTT broker instance. It will be over an insecure transport, but should give me a good feel for what this will look like running together. I'll keep ya updated.

Ryanb58 commented 3 years ago

Just testing out the integration a bit tonight. Figure I'd share the progress in a video.

https://www.youtube.com/watch?v=s2G-iIrtfhc

The Code isn't ready for prime time… Lots of embedded secrets and passwords… But I'll keep working on it to get it up to a server for other people to try in the near future.

In its current state... it is insecure.

f1vefour commented 3 years ago

Very nice, this will make wLED infinitely more useful for me and I'm sure a ton of others.

Looking forward to seeing this implemented.

spiro-c commented 3 years ago

I was looking at this and try to find some Google assistant to mqtt integration and i came across this three projects that can be use to control wled over Google assistant for two of them need to have full SSL, setting up google actions port forwarding so you can run them https://github.com/i8beef/HomeAutio.Mqtt.GoogleHome https://github.com/mikejac/node-red-contrib-google-smarthome

but one of them is much easier it just need node-red no need for port opening and SSL https://github.com/andrei-tatar/node-red-contrib-smartnora

luismasg commented 3 years ago

yesterday I tried a theory. here's another breadcrumb .

I used a shelly 1 and added an action to have it turn on Wled on switch.

it only works for turning on and off but it is very close to what I wanted. this feels like something that could be done in hubitat or home assistant.

Screenshot_20210705-193841.jpg

Ryanb58 commented 2 years ago

After a few weeks of messing with this stuff, there isn't really anything we can add to this repo to make this work. It involves a cloud provider setup with a connection to your IoT devices. Thus, maybe this PR should be closed until one of these two items are completed.

My original setup involved an insecure MQTT broker on the web. Which was abused. Thus, wouldn't provide a good user experience and is a security risk.

catarrer commented 2 years ago

Is there any update on getting wled working natively with google home? I'm looking forward to this as i have two nest hub 2 and a sonos one with google Assistant. The lights can only be cobtrolled by the one echo spot i own.

burgess40 commented 2 years ago

Matter as a replacement for current Google Home infrastructure looks promising as a robust solution to this as it doesn't require cloud access for smart home devices, similar to HomeKit. But no idea on licensing, security or implementation on esp32.

AndrewKassab commented 1 year ago

Any updates here? Or atleast a guide with the best DIY solution?

BrimStoneDK commented 1 year ago

Hi all. For starters, I´m a total noob. I just made my first LED strip with a Wemos D1 mini for the back of my tv with Wled+Hyperion. This works great. Wife asked if they could be turned on/off with Google assistant? So I am looking for this feature to. I did some digging around and found something called ESP Rainmaker which can be set up using a local MQTT broker. It can be used for ESP32 and ESP8266. The ESP Rainmaker app can then be added to Google Home without issue. I am no coder and only understand half of it. My thought was if ESP Rainmaker some how could be implemented in Wled? https://www.youtube.com/watch?v=Ta9dwDD9GyA

Regards

aenertia commented 1 year ago

If you have local mqtt/broker then you can do this via home assistant without additional work. The problem is when you don't want/have a local HA instance and would like to have them directly controlled via Google Home.

On Fri, 27 Jan 2023, 12:22 pm BrimStoneDK, @.***> wrote:

Hi all. For starters, I´m a total noob. I just made my first LED strip with a Wemos D1 mini for the back of my tv with Wled+Hyperion. This works great. Wife asked if they could be turned on/off with Google assistant? So I am looking for this feature to. I did some digging around and found something called ESP Rainmaker which can be set up using a local MQTT broker. It can be used for ESP32 and ESP8266. The ESP Rainmaker app can then be added to Google Home without issue. I am no coder and only understand half of it. My thought was if ESP Rainmaker/MQTT some how could be implemented in Wled? https://www.youtube.com/watch?v=Ta9dwDD9GyA

Regards

— Reply to this email directly, view it on GitHub https://github.com/Aircoookie/WLED/issues/31#issuecomment-1405804881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACF5L7NI5E7EDH6R2MWZNTWUMBLFANCNFSM4FH2MTMQ . You are receiving this because you commented.Message ID: @.***>

BrimStoneDK commented 1 year ago

Thats what I mean. This should work without a HA instance. Full control using Google assistant. Watch the video ;)

aenertia commented 1 year ago

You still have to have a local mqtt instance so this is pretty much the same thing, wether it's Google, home assistant, openhab or rainmaker ; it's still acting as the intimediary and you still need a local mqtt instance.

On Fri, 27 Jan 2023, 12:27 pm BrimStoneDK, @.***> wrote:

Thats what I mean. This should work without a HA instance. Full control using Google assistant. Watch the video ;)

— Reply to this email directly, view it on GitHub https://github.com/Aircoookie/WLED/issues/31#issuecomment-1405808857, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACF5L6LAIH7HRGYDTC36SDWUMB53ANCNFSM4FH2MTMQ . You are receiving this because you commented.Message ID: @.***>

BrimStoneDK commented 1 year ago

Yes yes agreed. The way I understand it is there has to be some sort of code on the ESP board to be able to add it to the Rainmaker app as an IOT device. The Rainmaker app is then added as a "skill" to Home Assistant there by adding voice control. I dont care if its local or cloud or both. As long as I can use voice control.

nightflasher commented 1 year ago

I've setup some IFTTT webhook, is working "okayish"

jbl-proglove commented 1 year ago

Based on my experience with AWS IoT Core and on what I found on the web about connecting an ESP32 to AWS, I'd like to share an idea how this might work without an MQTT broker in the middle.

The solution consists of two parts:

The part I can't say much about is how much effort this is to integrate, since I'm rather new to programming microcontrollers. My motivation is to get feedback on this aspect and on whether I'm missing something...

Cheers

jbl-proglove commented 1 year ago

Sorry, forgot to add the link to the tutorial...

leocastro5364 commented 12 months ago

hola, estoy usando esp32 con rainmaker y te deja configurar varios dispositivos, ya que tengo varias luces con wled esp8266 y no es compatible con casi nada el esp8266, se me ocurrio usar el esp32 como master y crear varias luces virtuales en el y que cada luz virtual le envie los comandos desde rainmaker a wled por GET o por MQTT, aun no lo termino de probar pero creo que va a ser una buena solucion para los viejos esp8266 wled que tengo ya en casa y funcionan muy bien. voy a ir comentando aca mis avances y si funciona entonces publico mi codigo para que lo trabajemos en conjunto y tengamos una solucion estable y sin tanto problemas de configurar servidores en la nube. yo estuve probando esp32 rainmaker y funciona muy bien con google home y alexa. @Aircoookie

softhack007 commented 12 months ago

hola, estoy usando esp32 con rainmake

Hi, unfortunately most people here (including myself) do not speak Portuguese, could you translate your comment into English? Thanks.

AlejandroHuerta commented 10 months ago

Has anyone investigated Google's local fulfillment sdk? https://developers.home.google.com/local-home/overview