GithubHelp home page GithubHelp logo

ylexus / jiotty Goto Github PK

View Code? Open in Web Editor NEW
7.0 0.0 2.0 830 KB

Java components for low level home automation coding

Java 99.97% Dockerfile 0.03%
guice iot automation fieldglass broadlink google-drive google-sheet gmail application-startup google-photos

jiotty's Introduction

Introduction

Jiotty is a library of java components aimed at home automation (IoT) enthusiasts who prefer to solder, assemble and code it all themselves as opposed to using one of existing automation hub solutions. This gives them 100% flexibility in all the automation tasks.

Structure

Jiotty consists of a number of small independent modules. Each module typically allows communication with a single Thing, for example, Google Drive, a thermostat or a smart plug.

Design principles

I am a fan of Google Guice as a dependency injection framework, a clearly visible point of entry to every API and good encapsulation. A a result, an entry point to any component is the corresponding Guice module. If your application is not using Guice (wait but why?), use the following pattern to obtain an instance of any component:

ExposedKeyModule<ComponentType> module = ComponentModule.builder()
    .setXxx()
    .build();
ComponentType component = Guice.createInjector(module).getInstance(module.getExposedKey());

Many components internally implement LifecycleComponent interface. Such components expect their start() method to be called on application startup and their stop() method to be called on application shutdown. A great way to manage that is to use the Application class that takes care of starting and stopping all the components. If you don't want to do that, you will have to perform this additional step on you application startup:

module
    .findBindingsByType(new TypeLiteral<LifecycleComponent>() {})
    .stream()
    .map(binding -> binding.getProvider().get())
    .forEach(LifecycleComponent::start);

and then on application termination call stop() on the same components in reverse order. Refer to the source code of Application as an example.

Getting started

Start by including the required net.yudichev.jiotty maven module into your project. For example, to work with a TP-Link smart plug, use this maven dependency:

<dependency>
    <groupId>net.yudichev.jiotty</groupId>
    <artifactId>jiotty-connector-tplinksmartplug</artifactId>
    <version>1.0.0</version>
</dependency>

Quality

At the moment most of the code is used in my home automation scenarios, so I have good confidence in its quality. However, only a small part of the code is unit tested and none is documented. I am actively working on this.

Components

jiotty-appliance

Use this module to implement an appliance - something that can be turned on or off, or receive other commands, such as increasing or decreasing volume.

jiotty-connector-aws

An higher abstraction over Amazon IoT MQTT messaging.

TODO document them all

jiotty's People

Contributors

dependabot[bot] avatar ylexus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jiotty's Issues

jiotty-connector-google-assistant introduces duplicate classes

[WARNING] jiotty-connector-google-assistant-1.4.1-SNAPSHOT.jar, proto-google-common-protos-1.17.0.jar define 21 overlapping classes: 
[WARNING]   - com.google.api.Http$Builder
[WARNING]   - com.google.api.HttpRule$PatternCase
[WARNING]   - com.google.api.CustomHttpPattern$1
[WARNING]   - com.google.api.HttpRule
[WARNING]   - com.google.api.HttpProto
[WARNING]   - com.google.api.CustomHttpPattern$Builder
[WARNING]   - com.google.api.CustomHttpPattern
[WARNING]   - com.google.api.HttpRule$Builder
[WARNING]   - com.google.api.HttpRuleOrBuilder
[WARNING]   - com.google.api.AnnotationsProto
[WARNING]   - 11 more...
[WARNING] jiotty-connector-google-assistant-1.4.1-SNAPSHOT.jar, protobuf-java-3.11.4.jar define 122 overlapping classes: 
[WARNING]   - com.google.protobuf.DescriptorProtos$FileDescriptorProtoOrBuilder
[WARNING]   - com.google.protobuf.DescriptorProtos
[WARNING]   - com.google.protobuf.DescriptorProtos$DescriptorProto$Builder
[WARNING]   - com.google.protobuf.DescriptorProtos$EnumDescriptorProto$EnumReservedRangeOrBuilder
[WARNING]   - com.google.protobuf.DescriptorProtos$FileOptions$OptimizeMode
[WARNING]   - com.google.protobuf.DescriptorProtos$DescriptorProto$ReservedRangeOrBuilder
[WARNING]   - com.google.protobuf.DescriptorProtos$OneofDescriptorProto$1
[WARNING]   - com.google.protobuf.DescriptorProtos$UninterpretedOption$NamePart$1
[WARNING]   - com.google.protobuf.DescriptorProtos$SourceCodeInfo
[WARNING]   - com.google.protobuf.DescriptorProtos$OneofOptions
[WARNING]   - 112 more...```

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.