GithubHelp home page GithubHelp logo

kandiki / reeflight Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gandulf94/reeflight

0.0 0.0 0.0 7.7 MB

Light control via MQTT and webinterface of my aquarium

License: MIT License

Python 26.84% HTML 30.12% JavaScript 42.64% CSS 0.01% Dockerfile 0.39%

reeflight's Introduction

ReefLight

I wrote a small python script that allows to control my aquarium lamp via mqtt protocoll. The aquarium lamp is a cheap wifi enabled ESP8266 chip with the mighty ESPEasy Firmware. The Firmware can be used to generate multiple PWM signals using directly the pins of the ESP8266 or by using the I2C PCA9685 board for example.

The python script can be controlled via a webinterface where the daily schedule of the different channels/colors of the lamp can be configured via drag and drop (ipadress:5000/schedule.html). Also each channel can be configured manually (ipadress:5000/).

The settings of the script are stored in the settings.json json file.

It contains an array of the different channel objects if you want to use multiple channels (for different light colors for example). A channel object contains

  • name of the channel for displaying in the webinterface
  • color of the channel for displaying in the webinterface
  • pwm PWM Value of the channel at last update (range 0..1)
  • manual
    true: The pwm value is not automatically updated and can be changed in the webinterface
    false: the channel is either in moolight or not in moonlight (regular) mode.
  • moonlight
    true: the script calculates at each update the brightness of the moon at your location that can be configured in latitude and longitude in the settings.json file. It uses the fractional phase of the moon and the height of the moon at the sky.
    false: the channels is working as regular channel. At each update it takes the data_points array and interpolates the pwm value using the pwm values of the two data_points greater and smaller to the current time
  • data_points Array storing the lightschedule in normal mode (not manual and no moonlight mode). It consists of time value pairs that can be changed using the ip-address:5000/schedule.html

The json file also contains general settings

  • mqtt_broker, mqtt_client_name, mqtt_port, mqtt_qos, mqtt_topic MQTT settings
  • seconds_between_updates seconds between two successive updates
  • longitude, langitude geographic location for the moonlight simulation

The script can be executed either

  • directly via python with the required packages in requirements.txt or
  • via Docker
    Build the Docker image with docker build -t reeflight . inside the git-repo and start a container with docker run -dit -v /home/pi/settings:/settings -v /etc/localtime:/etc/localtime --rm --net=host --name reeflight reeflight

reeflight's People

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.