Git Product home page Git Product logo

dysonapi-java's Introduction

DysonAPIJava

Simple Library to control Dyson Fans with Java Supported Devices:

  • Dyson Pure Cool™ (475)
  • Dyson Pure Hot+Coolᵀᴹ Link (455)
  • Any Device with similar functions. Fork the Library and add the device in DysonDeviceType.java

Import to project

  1. Download Jarfile with all dependencies in the "Releases" tab
  2. Maven: Repository:
    <repositories>
        <repository>
            <id>myMavenRepoRead</id>
            <url>https://mymavenrepo.com/repo/QPWAmwOfBYJMVg7noRm7/</url>
        </repository>
    </repositories>

Dependency:

    <dependencies>
        <dependency>
            <groupId>org.tschoerner.christian</groupId>
            <artifactId>dysonapi</artifactId>
            <version>2.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

How to use

Important! Please notice that at least Java 8 is required to use this Library

  1. Get the serial number of your device. It is in the format XXX-XX-XXXXXXXX. You can find it at the sticker of your fan or in the app:
    alt text

  2. Get the WIFI code from the sticker or the manual of your fan. It could look like this:
    alt text

  3. Hash the password using this python script (Python 2 & 3). Thanks to mecks52

  4. Get the local IP-Address of your fan

  5. Happy coding. This little example shows everything you need to know about the Library and how to use it:

    private static final String DYSON_IP = "192.168.86.XXX";
    private static final String DYSON_SERIALNUMBER = "NN2-EU-XXXXXXXX";
    private static final String DYSON_PASSWORD = "1SFkfgdXRXXXXXXXXXXXXXXXXXXXXXXX";

    public static void main(String[] args) throws MqttException {
        DysonDevice dysonDevice = new DysonDevice(DysonDeviceType.PURECOOLLINK, DYSON_IP,
                DYSON_PASSWORD,
                DYSON_SERIALNUMBER);

        dysonDevice.setField(DysonStateEnum.MODE, ModeField.ON);
        dysonDevice.setField(DysonStateEnum.STATUS, StatusField.ON); // not needed
        dysonDevice.setField(DysonStateEnum.FANSPEED, FanSpeedField.SPEED2);
        dysonDevice.setField(DysonStateEnum.NIGHTMODE, NightModeField.OFF);
        dysonDevice.setField(DysonStateEnum.OSCILLATION, OscillationField.ON);

        dysonDevice.getState(dysonState -> {
            int fanSpeed = dysonState.getInt(DysonStateEnum.FANSPEED);
            boolean nightMode = dysonState.getBoolean(DysonStateEnum.NIGHTMODE);

            System.out.println("FanSpeed: " + fanSpeed);
            System.out.println("NightMode: " + nightMode);
        });

        dysonDevice.getSensorData(dysonSensorData -> {
            Object temperature = dysonSensorData.get(DysonSensorEnum.TEMPERATURE);

            System.out.println("Temperature: " + temperature.toString());
        });

    }

Bugs - Contact

If you found a bug, have questions or want to message me please open an issue. Thank you!

dysonapi-java's People

Contributors

christiantschoerner avatar lukasjakobi avatar

Watchers

 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.