Git Product home page Git Product logo

yetanotherhueapi's People

Contributors

cstmth avatar dependabot[bot] avatar dereingerostete avatar ericparton avatar joker9944 avatar kakifrucht avatar zeroone3010 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

yetanotherhueapi's Issues

How to Control Lights with hue.getRaw()?

Hello , I am New Developer and I am Unable to Implement Lights with hue.getRaw().

I have Reached Till here.

                    Root root = hue.getRaw();
                    lights = (Map<String, LightDto>) root.getLights();

As LightDto has been deprecated for implementing turning ON/OFF Function .

         LightDto  lightDto= lights.get(<name>);
         LightState s =lightDto.getState();
         s.setOn(true);
         lightDto.setState(s);

Kindly Help me how to Control Lights without Room Object .

How can we Convert LIghtDto to Light so we can further use this object to access lights .

Correct me if i am approaching wrong way.

Thanks You in Advance .

Why such a restrictive State.Builder?

I'm not sure what the intention behind using a step builder pattern for it is with restrictions on alert and effect mode sending. It is allowed to send a State to the bridge that contains for example both a brightness change and a short alert. After the short alert the light will correctly set to the brightness change that was set in the same API call.

In general I'm not sure why we would need the step builder pattern here at all.

Add new light

How do I add a new light that didn't come with bridge. hue.getAllLights() and hue.getUnassignedLights() do not list new lights. Is there a way to scan and add a new light. A feature similar to "Add lights" in official Philips Hue android app. Thank you

Client code generation

Hi @ZeroOne3010,

I'm Thibault, the maintainer of OpenHue. I've been actively working on the openhue-api project, an OpenAPI spec for the Philips Hue REST API (v2).

Recently, I've been thinking about how beneficial it could be for your project to leverage this OpenAPI specification. By automatically generating the client code, it could alleviate the burden of writing and maintaining this aspect of the code in your project.

I'm more than willing to help with the integration of the OpenHue OpenAPI specification into your project!

Best,
@thibauult

Caching of states

The library should be able to cache the states of lights and sensors. Let's say you have 20 lights in your setup. Currently, if you want to know the states of all of those lights, the library will do 20 queries to the Bridge, which may take a couple of seconds or more. The API has a method of returning the states of all objects at once, so there should be a way to cache that result and to query the states of the lights and sensors from the cached result.

thank you so much

i really dont have any issues exept importing the pacakge but thats probaply just me since i just learned java but i just wanna say thank you for making this and putting so much effort in

NPE when bridge doesn't return sensors

Hi,

You have an NPE when the bridge doesn't send the "sensors" object entirely and the library refreshes the cached data:

Exception in thread "Thread-3" java.lang.NullPointerException
	at io.github.zeroone3010.yahueapi.Hue.refresh(Hue.java:151)
	at io.github.zeroone3010.yahueapi.Hue.doInitialDataLoadIfRequired(Hue.java:116)
	at io.github.zeroone3010.yahueapi.Hue.getGroupsOfType(Hue.java:179)
	at it.uniupo.giiot.iot.plugins.feedback.SmartLightsFeedback.onChange(SmartLightsFeedback.java:42)
	at it.uniupo.giiot.iot.core.AulosIotSubsystem.run(AulosIotSubsystem.java:205)

The Hue emulator we're using does that and it can't be worked around as sensors are not supported.

Since we have to deliver in just a few days, I've deployed a dirty fix on our side. If you're interested, I could clean it up and send a PR. (basic idea: check whether Root#getSensors() is null; if it is, fall back to an empty Map instead of trying to process it.)

Turn on / off room without setState (color, alert, etc...)

Hi, dev teams

I'm using your great library to control Philips hue lights. But I got 1 issue that when I want to turn off/on lights in room, I just want toggle lights (keep current lights state in the room) but I can't find any function to do that.

Could you provide users a function just only toggle room light? or maybe I miss it?

Thank you for your library.

Alert Functionality

Hey, first of all, thanks for this good work, I love your API. Hope I have not overlooked anything and do not annoy. I really need the alert functionality and don't want to emulate it. The original Hue app would have to understand alerts.

Add getUnassignedLightByName

Access to unassigned lights was added in 1.4.0. Other kinds of items can be accessed with "getXByName(String)" method. Add one for the unassigned lights as well.

save bridge details

how to save bridge details when it is already connected instead of doing the scanning and connection process again

Get rid of java.awt.Color

Originally brought up by @TobseF in #11, the need for the java.awt.Color class prevents this library from being used in Android projects. Rectify this.

This would probably lead to a breaking change, so now would be a good time to do this, considering that #22 will be a breaking change as well.

Add colorloop effect

Similarly to how alerts were added in #32, add the effect feature. (For now, the only effect that the Bridge supports is "colorloop".)

Implement a findByUiniqueId for lights and sensors

I would like to contribute a patch that allows the use of the uniqueId to search for lights and presence sensor. However, the new github authentication don't allow me to push the changes. Is there any group or email where i can post the patch?

Changing color of a light or room

is there a way to change the color since i have been struggling with this for several hours
still a beginner programmer so sorry if this is a stupid quetstion
image

UPnPDiscoverer V1 Bridge is not working

Hey I kinda used your UPnPDiscoverer as an example to get it working in my app. Had to rewrite it to Kotlin. It all worked but since a couple of days I can't seem to find V1 Bridges. Is that still working for you?

Thanks

JKS not found and java.io.FileNotFoundException: https://discovery.meethue.com/

I am trying to run an example app. But it throws the following exception when I use it as written in README

Future<List<HueBridge>> bridgesFuture = new HueBridgeDiscoveryService()
                        .discoverBridges(bridge -> Log.d("000000","Bridge found: " + bridge));
                final List<HueBridge> bridges;
                try {
                    bridges = bridgesFuture.get();
                } catch (ExecutionException e) {
                    throw new RuntimeException(e);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                if( !bridges.isEmpty() ) {
                    final String bridgeIp = bridges.get(0).getIp();
                    Log.d("000000","Bridge found at " + bridgeIp);
                    // Then follow the code snippets below under the "Once you have a Bridge IP address" header
                }

E FATAL EXCEPTION: Thread-3
Process: com.example.hueconnect, PID: 6275
com.example.hueconnect.yahueapi.HueApiException: java.security.KeyStoreException: JKS not found
at com.example.hueconnect.yahueapi.SecureJsonFactory.(SecureJsonFactory.java:45)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:131)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:95)
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:63)
Caused by: java.security.KeyStoreException: JKS not found
at java.security.KeyStore.getInstance(KeyStore.java:904)
at com.example.hueconnect.yahueapi.SecureJsonFactory.createHueSSLContext(SecureJsonFactory.java:89)
at com.example.hueconnect.yahueapi.SecureJsonFactory.(SecureJsonFactory.java:35)
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:131) 
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:95) 
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:63) 
Caused by: java.security.NoSuchAlgorithmException: JKS KeyStore not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.security.Security.getImpl(Security.java:628)
at java.security.KeyStore.getInstance(KeyStore.java:901)
at com.example.hueconnect.yahueapi.SecureJsonFactory.createHueSSLContext(SecureJsonFactory.java:89) 
at com.example.hueconnect.yahueapi.SecureJsonFactory.(SecureJsonFactory.java:35) 
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:131) 
at com.example.hueconnect.yahueapi.discovery.HueBridgeDiscoveryService.discoverBridges(HueBridgeDiscoveryService.java:95) 
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:63) 

So I changed the line in SecureJsonFactory.java:

  keystore = KeyStore.getInstance(KeyStore.getDefaultType());
  //keystore = KeyStore.getInstance("JKS");

Now, I don't get the JKS not found error:

FATAL EXCEPTION: Thread-3
Process: com.example.hueconnect, PID: 9654
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.FileNotFoundException: https://discovery.meethue.com/
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:68)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.FileNotFoundException: https://discovery.meethue.com/
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:372)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2049)
at com.example.hueconnect.MainActivity$1.run(MainActivity.java:66)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: https://discovery.meethue.com/
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer.lambda$discoverBridges$0$com-example-hueconnect-yahueapi-discovery-NUPnPDiscoverer(NUPnPDiscoverer.java:87)
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer$$ExternalSyntheticLambda0.get(Unknown Source:6)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1744)
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1736)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:377)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1185)
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1658)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1625)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.io.FileNotFoundException: https://discovery.meethue.com/
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:211)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:30)
at java.net.URL.openStream(URL.java:1072)
at com.fasterxml.jackson.core.TokenStreamFactory._optimizedStreamFromURL(TokenStreamFactory.java:262)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:1115)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3714)
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer.lambda$discoverBridges$0$com-example-hueconnect-yahueapi-discovery-NUPnPDiscoverer(NUPnPDiscoverer.java:81)
at com.example.hueconnect.yahueapi.discovery.NUPnPDiscoverer$$ExternalSyntheticLambda0.get(Unknown Source:6) 
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1744) 
at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1736) 
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:377) 
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1185) 
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1658) 
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1625) 
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) 

what is wrong ?

Possible NPE in isDaylightTime()

Hey, it's me again, I went a little deeper into your code and wanted to understand the tests, so I also ran the test run on my bridge. On daylight sensor i get a null pointer exception and it dies. I don't understand what daylight sensors are supposed to be, only have hue motion light sensors and was wondering if it could be those. Did some debugging and my bridge says I have a daylight sensor but don't quite understand it. Can you tell me what falls under this kind of sensors. And well, in general I just wanted to warn about a null pointer exception that may not show up for you

public boolean isDaylightTime() { return readStateValue("daylight", Boolean.class); }
This method causes the NPE.

hue cannot be resolved to a type

i am still a beginner programmer so this issue could be related to me but im getting this problem when im trying to ouput on or off

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Hue cannot be resolved
Hue cannot be resolved to a type
Hue cannot be resolved to a type

^^ is the error that im getting

this is my code
package Philips_hue;

import java.util.Collection;

import org.omg.PortableServer.POAManagerPackage.State;

import Philips_hue.api.*;

public class Test
{
public static void main(String args[])
{
final String bridgeIp = "192.168.178.555"; // Fill in the IP address of your Bridge
final String apiKey = "k55bmvO5SiJGgc7eFzzvuOTbZv83VEepPm-HIMCm"; // Fill in an API key to access your Bridge
final Hue hue = new Hue(bridgeIp, apiKey);
final Room room = hue.getRoomByName("Woonkamer").get();

		room.getLightByName("Zuil").get().turnOff();

i would appriciate it if you can help me

thanks in advance

Add Bridge discovery

Bridge discovery should be added. The Philips documentation is somewhat internally inconsistent, but the preferred order seems to be approximately like this:

  1. N-UPnP
  2. mDNS
  3. UPnP
  4. IP scan

Implement at least one of those.

EffectType from String "prism": not one of the values accepted for Enum

Hello,

I've got the folowing error :

io.github.zeroone3010.yahueapi.HueApiException: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type io.github.zeroone3010.yahueapi.v2.domain.update.EffectType from String "prism": not one of the values accepted for Enum class: [candle, sparkle, no_effect, fire]
at [Source: (sun.net.www.protocol.http.HttpURLConnection$HttpInputStream); line: 1, column: 34983] (through reference chain: io.github.zeroone3010.yahueapi.v2.domain.ResourceRoot["data"]->java.util.ArrayList[57]->io.github.zeroone3010.yahueapi.v2.domain.LightResource["effects"]->io.github.zeroone3010.yahueapi.v2.domain.Effects["status_values"]->java.util.ArrayList[3])
at io.github.zeroone3010.yahueapi.v2.Hue.refresh(Hue.java:109)

I think, this is new possible value for Effects, is there a workaround or could you update api
thank in advance

best Regards
Brien

Get state ... question ?

Hello,
Thanks for the API. It's easy and simple to use.
My question is how do you get the state of each light ? I don't see another way instead of creating a Thread in which a loop turns and get the state of each light.

If you could directly create a system with listerns it could be very great !
Thank you in advance

TemperatureSensor#getDegreesCelsius NPE

for (TemperatureSensor sensor : bridge.getTemperatureSensors())
	System.out.println(sensor.getDegreesCelsius());

Gives me:

java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "io.github.zeroone3010.yahueapi.TemperatureSensorImpl.readStateValue(String, java.lang.Class)" is null
	at io.github.zeroone3010.yahueapi.TemperatureSensorImpl.getDegreesCelsius(TemperatureSensorImpl.java:30)

Error when using v2

hi, just found out about this API, but when using v2 in Eclipse I always get the error

`[ForkJoinPool.commonPool-worker-9] INFO io.github.zeroone3010.yahueapi.HueBridgeConnectionBuilder - [{"success":{"username":"7pai1jaNCJzEPLsigj1ynlerO-fpBYOz8CK5zB9j"}}]

Store this API key for future use: 7pai1jaNCJzEPLsigj1ynlerO-fpBYOz8CK5zB9j

Exception in thread "main" io.github.zeroone3010.yahueapi.HueApiException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at io.github.zeroone3010.yahueapi.v2.Hue.refresh(Hue.java:135)
at io.github.zeroone3010.yahueapi.v2.Hue.(Hue.java:103)
at io.github.zeroone3010.yahueapi.v2.Hue.(Hue.java:116)
`

I am using eclipse 12/22. And Java Version 1.8.
If I am using the deprecated version 1 it all works and I can control all my hue stuff.
Don't know if I am doing something wrong or what the problem is

Change Brightness of a room

How does one change the brightness of a room
i have tried it these ways

int brightnessmax = 254;
int brighnessmin = 1;
JSlider slider = new JSlider(brighnessmin , brightnessmax);
slider.setBackground(Color.DARK_GRAY);
slider.setForeground(Color.DARK_GRAY);
slider.setBounds(157, 130, 111, 26);
slider.addChangeListener(new ChangeListener() {

	public void stateChanged(ChangeEvent e) {
		JSlider source = (JSlider)e.getSource();
		int brightness = (int)source.getValue();
		if(!source.getValueIsAdjusting()) {
			((BrightnessStep) room).brightness(brightness);
		}
	}
});
int brightnessmax = 254;
int brighnessmin = 1;
JSlider slider = new JSlider(brighnessmin , brightnessmax);
slider.setBackground(Color.DARK_GRAY);
slider.setForeground(Color.DARK_GRAY);
slider.setBounds(157, 130, 111, 26);
slider.addChangeListener(new ChangeListener() {
	
	public void stateChanged(ChangeEvent e) {
		JSlider source = (JSlider)e.getSource();
		int brightness = (int)source.getValue();
		if(!source.getValueIsAdjusting()) {
			//((BrightnessStep) room).brightness(brightness);	
			room.setState(((BrightnessStep) State.builder()).brightness(brightness));
		}
	}
});

but they both don't work
first one gives a ClassCastException which is logical but the 2nd gives an error on the code and gives The method setState(State) in the type Room is not applicable for the arguments (StateBuilderSteps.BuildStep)
How do I properly change the brightness then?

thanks for the great api btw it has been working really well

No logging by default

I like the library a lot, thank you! Just one minor quibble: the library does logging by default.

During discovery I see mDNS logging. Maybe there's a way to hide that, but it's not readily obvious.

While waiting for the bridge button press, the library prints a message to press the button. This doesn't match the logging of my app. I want to print my own message, but then I'd have two.

After that it seems I can connect and turn lights on/off without logging, so that's good.

I'd prefer if the library does not log anything by default. Having a way to turn it on would be OK. If something goes really wrong there's probably an exception with a message.

Why so restrictive?

There's a lot of use cases for things that for some reason are just restricted.

  • I cant access light Ids
  • There is no way to read a state from / to json even though thats what is really happening behind the scenes
  • I can read the brightness & saturation, but cannot create a state in the same way (builder accepts color)

Private constructors everywhere, Implementations hidden with protections, backing extremely basic interfaces (essentially hiding 90% of the information without reflection). Overly-simplified builders that prevent state-cloning for example. It feels like chewing rusty nails.

Cant Find Any Devices Without Error Codes

Hi, I can call my bridge without issue yet while searching for a room or light or alike it revives a wall of errors, any help would be much apricated.

(Here is the top line of the errors)
Exception in thread "main" io.github.zeroone3010.yahueapi.HueApiException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of io.github.zeroone3010.yahueapi.domain.Root out of START_ARRAY token
at [Source: (URL); line: 1, column: 1]

  • Sorry I the error code given is not enough to describe the issue thoroughly.

Importing this API

Hello ,

still learning the ropes of programming I took a break cuz school.
I used to make the hue classes in the API project package itself that worked.
I can't seem to find how I would import this API in a different java project all the library tutorials on the internet won't work I would appreciate if you could take a look :)
thanks in advance
package Hue_app;

import java.awt.EventQueue;
import io.github.zeerone3010.yahueapi;
import javax.swing.JFrame;
import org.jsoup.*;
import javax.swing.JLabel;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import java.awt.BorderLayout;

public class Hue_app {

private JFrame frame;

/**
 * Launch the application.
 */
public static void main(String[] args) {
	EventQueue.invokeLater(new Runnable() {
		public void run() {
			try {
				Hue_app window = new Hue_app();
				window.frame.setVisible(true);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}

/**
 * Create the application.
 */
public Hue_app() {
	initialize();
}

/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	frame = new JFrame();
	frame.setBounds(100, 100, 450, 300);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	JLabel label = DefaultComponentFactory.getInstance().createTitle("");
	frame.getContentPane().add(label, BorderLayout.NORTH);
}

}

Remove setter methods from DTO classes

The DTO classes that hold the data as parsed directly from the Bridge should not need any setter methods, as the Jackson library will set their values using reflection anyway. Remove the setter methods where applicable. A few of them have already been marked as deprecated.

This is a breaking change.

Add support for Friends of Hue Switches

Currently, a Friends of Hue switch will be handled as an "unknown" sensor.
The problem is, that it is not possible to access the state of an unknown sensor.

Here is an example json message from the hue API for a "Senic" Friends of Hue Switch.
There seems to be nothing specific for "Senic" in this message.

{
    "capabilities": {
        "certified": true,
        "inputs": [
            {
                "events": [
                    {
                        "buttonevent": 16,
                        "eventtype": "initial_press"
                    },
                    {
                        "buttonevent": 20,
                        "eventtype": "short_release"
                    }
                ],
                "repeatintervals": []
            },
            {
                "events": [
                    {
                        "buttonevent": 17,
                        "eventtype": "initial_press"
                    },
                    {
                        "buttonevent": 21,
                        "eventtype": "short_release"
                    }
                ],
                "repeatintervals": []
            },
            {
                "events": [
                    {
                        "buttonevent": 19,
                        "eventtype": "initial_press"
                    },
                    {
                        "buttonevent": 23,
                        "eventtype": "short_release"
                    }
                ],
                "repeatintervals": []
            },
            {
                "events": [
                    {
                        "buttonevent": 18,
                        "eventtype": "initial_press"
                    },
                    {
                        "buttonevent": 22,
                        "eventtype": "short_release"
                    }
                ],
                "repeatintervals": []
            }
        ],
        "primary": true
    },
    "config": {
        "on": true
    },
    "manufacturername": "PhilipsFoH",
    "modelid": "FOHSWITCH",
    "name": "Some Name",
    "productname": "Friends of Hue Switch",
    "recycle": null,
    "state": {
        "buttonevent": 22,
        "lastupdated": "2020-12-17T08:32:32"
    },
    "swupdate": {
        "lastinstall": null,
        "state": "notupdatable"
    },
    "swversion": null,
    "type": "ZGPSwitch",
    "uniqueid": "00:00:00:00:01:23:45:67-89"
}

Can you add support for this? Or would you accept a PR?

NoClassDefError on build

I get this error when running a built version of my app:

java.lang.NoClassDefFoundError: io/github/zeroone3010/yahueapi/discovery/HueBridgeDiscoveryService

Any ideas of how to fix? Works fine when running the app in intellij, but once built it won't work

getScene returns null

I'm trying to get the current scene of a room before changing it, but since I can't do that (from what I've found) I'm trying to get the scene of the two lights in that room like this:

prevScene = room.getLightByName("left light").get().getState().getScene();

However that just returns null. Am I using it wrong or is this a bug?

Server-Sent Events

The Hue API v2 (currently in beta) added support for push notifications using SSE.

This would be a great enhancement when working with buttons.

Do you have a plan to support this?

Add link to Javadocs

Add a javadoc.io badge into README.md:

[![javadoc](https://javadoc.io/badge2/io.github.zeroone3010/yetanotherhueapi/javadoc.svg)](https://javadoc.io/doc/io.github.zeroone3010/yetanotherhueapi)

Renders as follows:
javadoc

Get color of light

Hi, great API you made here. I've been enjoying it. I do have one question. I am using this to change the color of my Lightstrip based on other info I'm pulling. It does this like every five minutes. I'm wondering if there is some way I can check the current color of the lightstrip? The issue is that say x happens so the light will remain green. My program turns the light green and sets the brightness to max. However, each time it checks it is setting the light to green (dims light) then changes the brightness to max. This causes the lights to kind of change a little every time I check rather than staying one solid color.

Wondering if there is a way for me to implement this better?

Android API and Kotlin syntax

Hi @ZeroOne3010,

I needed a Philips HUE API lib for my Android App. Your yetanotherhueapi seemed to be a very good match. It's up to date, has a very good API, it's tested and it's available in the Maven central, Great 👍

But to use it on Android it has the problem, that it uses java.awt.Color which is not available there. Although the Java 8 API seems to be improper in the point of a Kotlin program - e.G. using Optionals. And you are forced to use Android api level 26 to get Optionals to work - instead of 6.

So I forked it and did a total to Kotlin conversation: yetanotherhueapi-kotlin

Do you have also plans to support Android or to migrate to Kotlin?

Best wishes,
Tobse

Add group 0, i.e. the "all lights" group

The Hue Bridge has a special group named 0, which always contains all the lights known by the Bridge. It would be useful to be able to access that group with the library.

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.