RFC: Outgoing websocket connections

Hi all,
This is a request for comments on a future feature.

I’ve been working on adding outgoing websocket connections. This would let you set up a websocket server somewhere, local or remote, that your Pixelblazes could connect to.

This would open up the possibility of controlling Pixelblazes remotely without a bunch of port forwarding tricks, and open the door for integration with other cloud services and integrations. You could also run this locally, and do Firestorm like things.

What could/would you do with this?

What Would be Supported

  1. The same websocket protocol and capabilities that exist now would be available, just with the connection going out to a server.
  2. I want to give folks a template/starter server project so that they can run their own PB server either locally or hosted somewhere.
  3. This would likely be a nodejs service, not totally unlike Firestorm. What would you like to see provided in a starter server?
  4. This would be enabled with a URL option in settings. You could add bits of data or tokens to the URL that the server could use, and the websocket can query the config to get the device ID, name, and other settings.
  5. This would work with group sync. Any pattern/control changes on the leader would sync even if followers weren’t connected to the remote service. Followers could also be connected for configuration/monitoring purposes, but would still sync patterns from their leader.

What it Wouldn’t Do

  1. I don’t plan on streaming status updates and preview frames since those could eat considerable bandwidth over potentially remote connections. At least not by default, or indefinitely, perhaps requested by a command. Otherwise, bandwidth is minimal with only pattern change notification messages.
  2. Aside from things already supported via the websocket like patterns, config, etc., the remote server wouldn’t have the same kind of full access to modify the files on a Pixelblaze that the local http API has.
  3. Initially, this will be over http, not https, though I hope to add that at some point. This is mainly due to the complexity and resource constraints of managing certs and the encryption itself.
  4. They joke there’s no ‘S’ for Security in IoT, even less without https, but I’m keeping an eye out for potentially dangerous things that this would open up. Firmware is already signed and prevents installing malware and that sort of thing (plus the websocket can’t push random firmwares), so your PB won’t be taken over if the remote service is compromised. But if hacked, it could delete patterns, config, and set LEDs to 100% full white. If you have thoughts/concerns on this I’d love to hear them!

Potential Directions / Uses

  • Remote pattern, controls, and brightness management
  • Coordinating several Pixelblazes distributed over more than a LAN/WLAN, like public installations with a hotspot.
  • Easier home automation integrations
  • Adapter / relay services like MQTT
  • Future cloud service. While I want to start with and always have a cloud-free option, I think something like this could be useful for many folks. I’d like to hear your thoughts on this.
4 Likes

Sounds promising!

I imaging you configure an IP for it to connect to in Settings, and that server is still the one publishing commands; I assume those commands scopable to particular devices by filtering a list of connected IPs kind of like Firestorm would, yeah?

I can imagine some interesting use cases for arbitrary event-based publishing from PB to server (“GPIO went low-to-high, publish this”), but this might be difficult in an initial scope especially without more explicit string-as-char-array support. You can poll today, but it can be network heavy to react quickly.

Back to the inbound API, I think I’ve seen a few feature requests here to support a REST or RPC style http API for home automation and ITTTT integrations that don’t support ws://. I imagine a single endpoint that accepts the existing WS verbs. That could unlock a few people who can’t fork Firestorm but could copy-paste a URL. No idea if that’s a lot more resource intensive than ws://.

3 Likes

Sounds ok, but doesn’t really interest me.

I don’t want to need anything other than a bunch of pixelblazes with a lazy asynchronous shared variable space as imagined in Pixelblaze for Burning Man 2025 ? Sync/Wifi + New product roadmap? - #8 by sorceror

1 Like

I don’t really understand well how websocket works but I sense it would open the way to be able to cotnrol a Pixelblaze from Home Assistant for example ?

If that’s the case it would help a lot because today I think the big issue with pixelblaze is the lack of easy control ability which restricts (at least for me) the use to wearables or “leave it like this” automatic installations:

  • either you connect to the webpage, which is not really “user friendly”
  • or you add physical buttons (and that’s a lot of soldering / fitting)
  • or you develop a whole app for it

So far it’s very hard to integrate to any smart home apps, all I saw is a Firestorm plugin for Home Assistant but it’s not usable in automations or scenes for example. MQTT support would help a lot for sure, and in this case what would be good would be:

  • Being able to discover a Pixelblaze
  • List patterns and activate them
  • Pattern controls
  • Luminosity
  • ON/OFF
  • Ideally access also Pixelbaze settings

Not sure if that answers the question…

2 Likes