BSD-3-Clause licensed and maintained by Andreas Ländle
This version can be pinned in stack with:wled-json-0.1.0.0@sha256:741dca1ec5c5c390a3f745b6243f7b7fa7c0a67c42da14b426fb531a1da8bbfb,3242

Module documentation for 0.1.0.0

wled-json ✨

Haskell bindings for controlling WLED devices, with a focus on Octolamps

Introduction 💡

This Haskell library provides a convenient interface for interacting with WLED devices, particularly those based on the popular Octolamp design. It leverages the WLED API (https://kno.wled.ge/) to allow you to control various aspects of your LED lights, including:

  • Color: Set the color of your lights using various color spaces (RGB, HSV, etc.)
  • Brightness: Adjust the overall brightness of your lights

Usage 📲

import           Control.Concurrent (threadDelay)
import           WLED.Device        (getLampState, setLampState)
import           WLED.Lamp.Octocat  (octocatSpec)
import           WLED.Pattern.Flags (bulgaria)
import           WLED.Types         (diff)

main :: IO ()
main = do
    -- Connect to a WLED device
    lampState <- getLampState wledUrl
    case lampState of
        Left errMsg -> putStrLn errMsg
        Right initialState -> do
            -- Display the Bulgarian flag on an Octolamp
            _ <- setLampState wledUrl (bulgaria octocatSpec)

            -- Just sleep five seconds
            threadDelay 5000000

            -- Restore the initial state
            Right currentState <- getLampState wledUrl
            _ <- setLampState wledUrl (diff currentState initialState)
            pure ()
  where
    wledUrl = "http://192.168.178.34"

Features 👍

  • Comprehensive WLED API coverage
  • Type-safe interactions
  • Easy-to-use API
  • Specific support for Octolamps
  • Reusable pattern for other lamp designs

Contributing 🤝

Contributions are welcome! Please feel free to open an issue or submit a pull request.

License ✌️

BSD-3-Clause

Changes

Changelog for wled-json

Hopefully all notable changes to this project will be documented in this file.

The project adheres to the Haskell Package Versioning Policy.

Unreleased

  • Awesome upcoming features!

0.1.0.0 - Support differently designed lamps - 2025-05-29

  • Separate lamp specification from WLED interaction - so that own designs could be integrated.

0.0.1.1 - Small cosmetic improvements - 2025-03-28

  • Demonstration:
    • Added menu and option to change wled device URL via terminal or command line argument
    • Added tool to traverse every single LED (to be able to better detect positions)
  • Octolamp Support:
    • Added more flags with three vertical stripes

0.0.1.0 - Initial release - 2024-12-02

  • Core Functionality:
    • Basic connection to WLED devices
    • Setting color, brightness, etc.
  • Octolamp Support:
    • Initial support for Octolamp-specific features (provide the French flag)