Git Product home page Git Product logo

broadlink-java-api's People

Contributors

alpapad avatar bwssytems avatar computerlyrik avatar javieu avatar kaminskypavel avatar mob41 avatar molpie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

broadlink-java-api's Issues

Update maven package

Can you upload the latests changes to maven , support for RM3Mini seems to be missed on the 1.0.1 version.
Thank you in advance!

Multiple Network Interfaces

Hello,

first of all thank you for this great piece of work!

I have a small question regarding systems with multiple interfaces. I run my broadlink devices on a separate network, such that they have no access to the internet. This means I have two ethernet devices in my machine - one to the outside world and one for the internal network.

Is there a way to tell the discoverDevices method (and essentially the whole library) to use only one of the to network interfaces? I haven't found yet a way to do so, but might have just overseen it.

Thanks a lot for any enlightenment.

Not working on command packets

The following code authenticates and tell RM to enter learning mode.

However, this code does work in discovery but fails at dev.auth() (evidence downstairs)

BLDevice[] devs = BLDevice.discoverDevices(0);
System.out.println(devs.length);

BLDevice dev = devs[0];

System.out.println(dev.getMac().getMacString());

dev.auth();

RM2Device rm = (RM2Device) dev;
rm.enterLearning();

Python code for testing:

import broadlink

devs = broadlink.discover(timeout=5)

devs[0].auth()

devs[0].enter_learning()

The executable to be tested

Please run in a console. This does not show any GUI.

java -jar example.jar

Source code to see what it runs

[Download example.jar]

Capture data

macStrToBytes assumes numbers only

maybe im missing something out, but it seems like macStrToBytes(String macStr) assumes that macStr contains numbers only, and following loop throws an exception

 byte[] bout = new byte[6];
         for (int i = 0; i < macs.length; i++) {
             try {
                 bout[i] = Byte.parseByte(macs[i]);
             } catch (NumberFormatException e) {
                 throw new MacFormatException(macStr, e);
             }
         }

Newbie with Broadlink RM Mini3, not sure how to determine codes to send?!

Hi,
I've just bought a Broadlink RM Mini3 which I'm hoping to use to turn a TV on/off when triggered by an existing Java application of mine.
I've imported your class in pom.xml and appear to be able to create an RM2Device successfully, however I don't know how to use this API to do what I need. How do I determine what string should be sent?
Sorry if I'm missing something! If anybody has some examples I can start to use then I'd be massively grateful!
Thank you.

Compatibility chart for README

Should we add a documentation, which devices have been tested successfully?
Ideally with the last working version and the user who tested it?

Problem with sending a command

Hi,

first, thanks for your effort. Cool stuff.

Looks like, sending my command isn't working.
I'm doing the following:
RM2Device rm2 = new RM2Device(rmip, new Mac(b));
rm2.auth();
rm2.enterLearning(); // this gives me a success and led is on
Thread.sleep(10000); // during that time, I press the button on my remote and led goes off
byte[] command = rm2.checkData();
rm2.sendCmdPkt(new SendDataCmdPayload(command));

I'd expect that my command is sent again. Or am I doing something wrong? I have a RM pro, I think. It's this one:
https://www.amazon.de/Urant-Universal-Intelligent-Controller-Automation-RF-Fernbedienung-Funktioniert-Smart-Remote-Control/dp/B06XKPFBMP/ref=sr_1_4?ie=UTF8&qid=1513372563&sr=8-4&keywords=rm+pro

The same command works when I use the Broadlink app.

Thanks for your help.

getStates() not work

getRawPayloadBytesPadded()中
byte[] encData = subbytes(data, BLDevice.DEFAULT_BYTES_SIZE, data.length);
已经去掉了长度 DEFAULT_BYTES_SIZE = 0x38; // 56-bytes 的header ,然而在getStatesRaw() 中截取state时又算上了header的长度。
解决方法 :
if (pl[0x3c] >= 48 && pl[0x3c] <= 57) {
String decodeValue1;
decodeValue1 = String.valueOf(pl[0x46]);
state = Short.decode(decodeValue1).byteValue();
} else {
state = pl[0x46];
}

0x3c 和0x46的地方的地方需要减去 DEFAULT_BYTES_SIZE = 0x38 的长度。
if (pl[0x4] >= 48 && pl[0x4] <= 57) {
String decodeValue1;
decodeValue1 = String.valueOf(pl[0xe]);
state = Short.decode(decodeValue1).byteValue();
} else {
state = pl[0xe];
}

A1 temperature sending strange number

Hello,
I'm working on getting some sensor data from the A1 environmental sensor.
My code is:

A1Device device = new A1Device("192.168.0.101", new Mac("34:EA:34:C7:A2:40"));
device.auth();
System.out.println("Temp: " + device.getSensorsData().getTemp());

For the first run I got a normal value, 22.1, which was the same as in the app.
Ever since I only get the value 97.8 which seems to be quite strange.
Using the same connection from the python library (https://github.com/mjg59/python-broadlink) I get the same result at the app, so I suppose the error could be somewhere around here

A1Device changes require testing

@computerlyrik I have removed the following code:

if (pl[0x4] >= 48 && pl[0x4] <= 57) {
                String decodeValue1;
                String decodeValue2;
                byte value1;
                byte value2;
                decodeValue1 = String.valueOf(pl[0x4]);
                decodeValue2 = String.valueOf(pl[0x5]);
                value1 = Short.decode(decodeValue1).byteValue();
                value2 = Short.decode(decodeValue2).byteValue();
                sensorData.setTemperature((float) ((value1 * 10 + value2) / 10.0));
                decodeValue1 = String.valueOf(pl[0x6]);
                decodeValue2 = String.valueOf(pl[0x7]);
                value1 = Short.decode(decodeValue1).byteValue();
                value2 = Short.decode(decodeValue2).byteValue();
                sensorData.setHumidity((float) ((value1 * 10 + value2) / 10.0));
                decodeValue1 = String.valueOf(pl[0x8]);
                sensorData.setLight(Short.decode(decodeValue1).byteValue());
                decodeValue1 = String.valueOf(pl[0x0a]);
                sensorData.setAirquality(Short.decode(decodeValue1).byteValue());
                decodeValue1 = String.valueOf(pl[0xc]);
                sensorData.setNoise(Short.decode(decodeValue1).byteValue());
            } else {
                sensorData.setTemperature((float) ((pl[0x4] * 10 + pl[0x5]) / 10.0));
                sensorData.setHumidity((float) ((pl[0x6] * 10 + pl[0x7]) / 10.0));
                sensorData.setLight(pl[0x8]);
                sensorData.setAirquality(pl[0x0a]);
                sensorData.setNoise(pl[0xc]);
            }

Something crazy. 😸 I don't have a A1 device currently. Can you help me to test it out the current code?

[Patch] Read Power Consumption from SP2/SP3 devices

https://pastebin.com/kidagDLn

I'm too lazy to do this properly, here is a quick thing to add in the SP2Device class that allows reading of power consumption. Returns exactly the same values as in the app.

Also, for some reason, my SP2 plugs return this as their model: -27526
I had to add it manually in BLDevice to force it to create an instance of it. It's written "SP3" on my plugs but they work with SP2 api so who knows.

The patch above works for my specific plugs, SP3, european style connector: https://2.bp.blogspot.com/-idwScYkor94/WJWdYcM1LEI/AAAAAAAAFvE/MapfzRuCQX8Ift1eqLiDlrSnRo1modgLQCLcB/s1600/Broadlink-SP3.jpg

Completing Missing JavaDoc

JavaDoc generation comment block is missing for the following files and methods. Source: https://travis-ci.org/mob41/broadlink-java-api/jobs/393332437#L1590

@alpapad Please help completing these, thanks!

  • com/github/mob41/blapi/dev/hysen/BaseHysenDevice.java:121: warning: no @param for autoMode
    public void setMode(boolean autoMode, LoopMode loopMode, SensorControl sensorControl) throws Exception {

  • com/github/mob41/blapi/dev/hysen/BaseHysenDevice.java:121: warning: no @param for loopMode
    public void setMode(boolean autoMode, LoopMode loopMode, SensorControl sensorControl) throws Exception {

  • com/github/mob41/blapi/dev/hysen/BaseHysenDevice.java:121: warning: no @param for sensorControl
    public void setMode(boolean autoMode, LoopMode loopMode, SensorControl sensorControl) throws Exception {

  • com/github/mob41/blapi/dev/hysen/BaseHysenDevice.java:136: warning: no @param for autoMode
    public void setMode(boolean autoMode, LoopMode loopMode) throws Exception {

  • com/github/mob41/blapi/dev/hysen/BaseHysenDevice.java:136: warning: no @param for loopMode
    public void setMode(boolean autoMode, LoopMode loopMode) throws Exception {

  • com/github/mob41/blapi/MP1Device.java:72: warning: no description for @throws
    * @throws Exception

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:107: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:122: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:137: warning: no @return
    public short getOsv() {

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:149: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:163: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:176: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:189: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:204: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:219: warning: no description for @return
    * @return

  • com/github/mob41/blapi/dev/hysen/BaseStatusInfo.java:234: warning: no description for @return
    * @return

A1 Sensors information are not being successfully retrieved

Hi, sorry if this is not the proper way to raise this question; I have downloaded and tested your project (BTW congrats and thanks!) but I am obtaining weird data from A1 sensor after a succesful auth:

EnvironmentalSensorRaw [temperature=-82.2, humidity=53.8, light=-28, airquality=3, noise=-73]

And basically I am getting always exactly same values.

Is EnvironmentalSensorRaw -> getTemperature() supposed to return a Celsius temperature?

I must first confess I have never coded a line of Python, but in the mjg59 python-broalink library, I see that in A1 the payload is decrypted using this code:

payload = self.decrypt(bytes(response[0x38:]))

While in your code it is like this:

byte[] pl = aes.decrypt(data);

I am not sure what bytes(response[0x38:]) does, but is this equivalent?

Thanks in advance :) I am available if you do not own a A1 device and want me to do any kind of test.

Best regards and thank U!

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.