Hacker News new | ask | show | jobs
by justinsaccount 976 days ago
Is there a SIMPLE way to have a small python or go program act as a "switch" that shows up in Google home? The last time I tried looking at the matter stuff even checking out the git repo required gigabytes of storage and it seemed the opposite of simple.
2 comments

If you can do Typescript, matter.js makes it trivial to at least create a virtual matter device. Five minutes to clone the repo, build, run and pair with Google, Apple, Alexa, SmartThings, etc. The one caveat is certification. With Google you need to register as a developer so it allows an uncertified device. The others just give a warning.

See: https://github.com/project-chip/matter.js

oooh! that looks perfect. The main repo is a bit much, and much of the examples seem to assume you're running on bare metal embedded

I'd have preferred another language, but what I want to do is ultimately so simple that TS should be fine.

Yeah - you can even pass your own python, go, bash, etc. "on/off" script as a parameter to the example matter-device so you can get away with no code changes at all. You can get help at the listed discord server.
Well you were right, it took not even 5 minutes to get it working. Even with having to register it as a development device. Unfortunately as it turns out I don't have any devices that can act as a matter hub for google home, so after finding and adding the device, it ends up not being able to talk to it anyway :-(

Ironically I have 4 chromecasts, but they are connected to real amplifiers and speakers, so I never felt the need to get one of the smart speakers which can act as a hub.

Yeah, you typically need some sort of hub unless you run Home Assistant. My understanding is that it doesn't need any hub for Matter support.
> Is there a SIMPLE way to have a small python or go program act as a "switch" that shows up in Google home?

You can create virtual devices using Homebridge plug-ins. Here's an example: https://www.npmjs.com/package/homebridge-dummy

Yes, that would be useful if I used homekit...
You don’t need to use HomeKit for this to work, but you will need https://github.com/oznu/homebridge-gsh. (Caveat: I haven’t tried this myself since I use HomeKit and Alexa devices.)
Oh.. less interesting how that I see how it works. I thought this would be a local thing, but it apparently connects to some third party service:

    // establish new websocket connection
    const socket = new WebSocket(`wss://homebridge-gsh.iot.oz.nu/socket?${querystring.stringify(qs)}`);
big YIKES from me there, especially because this is not really documented or even mentioned at all.
Ah shoot. Glad you caught that!
Oh, now that is interesting. The requirement for "insecure mode" is a bit scary sounding, but for what I want to control, it shouldn't matter.