Code Monkey home page Code Monkey logo

lifxfluentservice's Introduction

Lifx service to update lights on a schedule, plus a fluent wrapper for the states update API

Fluent wrapper for lifx state updates, plus small script I use to make my lights adjust according to a schedule via AWS.

I would like to credit https://github.com/mensly/LifxHttpNet project for the lifxColor class I used. The fork at https://github.com/caleblanchard/LifxHttpNet is probably easiest to use if you want an API and there's a nuget.

I would have used that library but I needed to be able to change colour without affecting the power state, plus run a number of updates with one call, neither of which were possible with the original library. Plus I really like Fluent API libraries to work with.

The waypoints for lights are contained in the TimeConfig.cs, change according to preference.

If you just want to use as-is there's an example package you can upload immediately in the packaged folder, you can upload and start using it immediately.

The environment variables you'll need to set on AWS are:

  • LifxApiToken: your token
  • DaynightLights: comma seperated list of lights you want to set via kelvin, by label.
  • FullColourLights: comma seperated list of lights you want to set by colour, by label.
  • TimezoneId: the full text timezone ID, in AWS these are linux so in the format "Australia/Sydney" - if you run on a windows machine this will need to look more like "AUS Eastern Standard Time".
  • ChangeDuration: optional, defaults to 10 minutes. integer of number of seconds.

You'll need to trigger it to run, CloudWatch event trigger can trigger it according to whatever schedule you'd like. I chose every 15 minutes, which is a cron job with a statement like this: cron(0/15 * * * ? *).

I can fork and add the fluent interface if anyone is interested, or add some functions and publish it as a standalone nuget.

Currently my lights are happily updating from the cloud however so I'm likely to leave this as is.

To create a package to upload, use dotnet lambda package command line argument. You'll need to install the AWS command line tools, see here: https://docs.aws.amazon.com/lambda/latest/dg/lambda-dotnet-coreclr-deployment-package.html

I haven't worked with AWS before so I didn't set anything up that was particularly complex. Hopefully you can get it working easily.

lifxfluentservice's People

Contributors

dylandhall avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.