Coder Social home page Coder Social logo

basil96 / civilite Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 72 KB

Library for managing outdoor lighting when building occupancy and available daylight must be considered.

License: MIT License

Python 100.00%
building-automation lighting-controller astronomical-clock

civilite's People

Contributors

basil96 avatar scliddle avatar

Stargazers

 avatar

Watchers

 avatar  avatar

civilite's Issues

Improve handling of custom locations in astral

The current astral.py module we use here is a local copy from the official astral package, with custom locations added to the _LOCATION_INFO string. See if it's possible to add a custom location from client side so we would eliminate astral.py from this project and just use the official package via pip so that future updates to astral go smoothly.

create a Configuration

  • Create a civilite.Configuration class.

  • Storage schema:

    • use JSON for the config file.
    • Store the file as configuration.json in the user's home dir: os.path.expanduser('~').
    • Windows: .civilite subdirectory.
    • Linux: ~/.local/share/civilite directory.
  • API: TBD. A simple dictionary based directly on JSON might suffice.

  • As a start, move getCurrentSchedule() function out of schedule.py and into configuration.json.

unit tests for timezones

Discussion in #27 revealed that our scheduling logic is untested with regard to timezones. We need at least these test cases:

  1. WeeklySchedule instance provided with a tzinfo that matches a provided location.

    • expectation: getCivilTwilight should return the appropriate datetime for the location on a given date in the provided tzinfo timezone.
  2. WeeklySchedule instance provided with a location and tzinfo=None.

    • expectation: getCivilTwilight should return the appropriate datetime for the provided location on a given date but in the timezone of the caller's OS.
  3. WeeklySchedule instance provided with a tzinfo that is different from a provided location.

    • expectation: getCivilTwilight should return the appropriate datetime for the provided location on a given date but in the provided tzinfo timezone.
  4. WeeklySchedule instance provided with a location and no tzinfo argument.

    • expectation: getCivilTwilight should return the appropriate datetime for the provided location on a given date but in the UTC timezone.

Choose a few sample dates, locations, and twilight times from timeanddate.com, no fancy web scraping needed.

Bonus: use dates/times/locations where DST is involved. For example, try a location where DST is not practiced (Arizona?) while providing a tzinfo where DST is in effect on the given day.

Create a distributable package

I've never done this before, so this is a science project.
I think this involves a setup.py script and a manifest file, among other things, that turn this project into a distributable package.
The advantages are many; you get a properly installed package, you're forced to run tests against the installed code instead of a temporarily patched sys.path, which should promote catching any issues early.

add .pylintrc

Create and add a .pylintrc for existing coding standards

move schedule.outputSunsets() to scripts

Move the outputSunsets() function and its module-level client code to a new file scripts/make_calendar_csv.py. Leave the functionality unchanged, i.e., it should still create a sunsets.csv file as before.

The goal is to make sunsets.py a library module, not a top-level script.

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.