Philips Hue is an intelligent light collection; it will help you control your home’s lights using a smartphone, tabs, etc. Philips Hue can welcome you home, wake you up, get you energized, help you feel safe, improve your mood and much more.
Philips Hue uses two communication protocols to control the bulbs: Wifi/Ethernet and ZigBee.
In the below picture, you will get an exact idea of how it works.
A few days ago, I got a chance to work on this technology. It’s very interesting!!! Hope you also enjoy it.
Here I will give you one example using the Android platform. In this example, we will see how we will connect with bridges and connect with bulbs ON/OFF bulbs using mobile.
Need to create a “PHHueSDK” instance.
We can directly get the quick start demo of hue Philips; click here.
// Gets an instance of the Hue SDK. PHHueSDK phHueSDK = PHHueSDK.create(); // Set the Device Name (name of your app). This will be stored in your bridge whitelist entry. phHueSDK.setAppName(getResources().getString(R.string.app_name)); phHueSDK.setDeviceName(Build.MODEL); // Register the PHSDKListener to receive callbacks from the bridge. phHueSDK.getNotificationManager().registerSDKListener(listener);
Search available bridges in a network
PHWizardAlertDialog.getInstance().showProgressDialog(R.string.search_progress, PHHomeActivity.this); PHBridgeSearchManager sm = (PHBridgeSearchManager) phHueSDK.getSDKService(PHHueSDK.SEARCH_BRIDGE); // Start the UPNP Searching of local bridges. sm.search(true, true);
Using PH Listeners we can get the result of search bridge methods :
public interface PHSDKListener { void onCacheUpdated(List<Integer> cacheNotificationsList, PHBridge bridge); void onBridgeConnected(PHBridge bridge, String userName); void onAuthenticationRequired(PHAccessPoint accessPoint); void onAccessPointsFound(List<PHAccessPoint> accessPoints); void onError(int code, String message); void onConnectionResumed(PHBridge bridge); void onConnectionLost(PHAccessPoint accessPoint); void onParsingErrors(List<PHHueParsingError> parsingErrors); } // Local SDK Listener private PHSDKListener listener = new PHSDKListener() { @Override public void onAccessPointsFound(List<PHAccessPoint> accessPoint) { Log.w(TAG, "Access Points Found. " + accessPoint.size()); PHWizardAlertDialog.getInstance().closeProgressDialog(); if (accessPoint != null && accessPoint.size() > 0) { phHueSDK.getAccessPointsFound().clear(); phHueSDK.getAccessPointsFound().addAll(accessPoint); runOnUiThread(new Runnable() { @Override public void run() { adapter.updateData(phHueSDK.getAccessPointsFound()); } }); } } @Override public void onCacheUpdated(List<Integer> arg0, PHBridge bridge) { Log.w(TAG, "On CacheUpdated"); } @Override public void onBridgeConnected(PHBridge b, String username) { phHueSDK.setSelectedBridge(b); phHueSDK.enableHeartbeat(b, PHHueSDK.HB_INTERVAL); phHueSDK.getLastHeartbeat().put(b.getResourceCache().getBridgeConfiguration() .getIpAddress(), System.currentTimeMillis()); prefs.setLastConnectedIPAddress(b.getResourceCache().getBridgeConfiguration().getIpAddress()); prefs.setUsername(username); PHWizardAlertDialog.getInstance().closeProgressDialog(); startMainActivity(); } @Override public void onAuthenticationRequired(PHAccessPoint accessPoint) { Log.w(TAG, "Authentication Required."); phHueSDK.startPushlinkAuthentication(accessPoint); startActivity(new Intent(PHHomeActivity.this, PHPushlinkActivity.class)); } @Override public void onConnectionResumed(PHBridge bridge) { if (PHHomeActivity.this.isFinishing()) Return Log.v(TAG, "onConnectionResumed" + bridge.getResourceCache().getBridgeConfiguration().getIpAddress()); phHueSDK.getLastHeartbeat().put(bridge.getResourceCache().getBridgeConfiguration().getIpAddress(), System.currentTimeMillis()); for (int i = 0; i < phHueSDK.getDisconnectedAccessPoint().size(); i++) { if (phHueSDK.getDisconnectedAccessPoint().get(i).getIpAddress().equals(bridge.getResourceCache().getBridgeConfiguration().getIpAddress())) { phHueSDK.getDisconnectedAccessPoint().remove(i); } } } @Override public void onConnectionLost(PHAccessPoint accessPoint) { Log.v(TAG, "onConnectionLost : " + accessPoint.getIpAddress()); if (!phHueSDK.getDisconnectedAccessPoint().contains(accessPoint)) { phHueSDK.getDisconnectedAccessPoint().add(accessPoint); } } @Override public void onError(int code, final String message) { Log.e(TAG, "on Error Called : " + code + ":" + message) } } } @Override public void onParsingErrors(List<PHHueParsingError> parsingErrorsList) { for (PHHueParsingError parsingError: parsingErrorsList) { Log.e(TAG, "ParsingError : " + parsingError.getMessage()); } } };
After getting the list of available bridges, select bridge and connect with a bridge using “PHBrideg”.
PHAccessPoint accessPoint = (PHAccessPoint) adapter.getItem(position); PHBridge connectedBridge = phHueSDK.getSelectedBridge(); if (connectedBridge != null) { String connectedIP = connectedBridge.getResourceCache().getBridgeConfiguration().getIpAddress(); if (connectedIP != null) { // We are already connected here:- phHueSDK.disableHeartbeat(connectedBridge); phHueSDK.disconnect(connectedBridge); } } PHWizardAlertDialog.getInstance().showProgressDialog(R.string.connecting, PHHomeActivity.this); phHueSDK.connect(accessPoint);
Now select the bulbs and perform operations on selected bulbs.
Here we can switch ON/OFF lights, set brightness, set color of lights using “PHLightState”
List<PHLight> allLights = bridge.getResourceCache().getAllLights(); PHLightState lightState = new PHLightState(); lightState.setOn(isOn); lightstate.setBrightness(40) bridge.updateLightState(allLights.get(position), lightState, listener);
Make sure brightness must be in between 0 – 254.
Here we just learn basic functionalities of Philips hue. We can do so many things using Philips hue SDK.
The smart lights concept is becoming very popular nowadays; I enjoyed it a lot while learning about Philips hue development; I hope you guys will also enjoy it.
Hope it will be helpful to you!!!😊
How to Effectively Hire and Manage a Remote Team of Developers.
Download NowMaster Epic Integration with SMART on FHIR in Just 60 Minutes
Register HereMindbowser played a crucial role in helping us bring everything together into a unified, cohesive product. Their commitment to industry-standard coding practices made an enormous difference, allowing developers to seamlessly transition in and out of the project without any confusion....
CEO, MarketsAI
I'm thrilled to be partnering with Mindbowser on our journey with TravelRite. The collaboration has been exceptional, and I’m truly grateful for the dedication and expertise the team has brought to the development process. Their commitment to our mission is...
Founder & CEO, TravelRite
The Mindbowser team's professionalism consistently impressed me. Their commitment to quality shone through in every aspect of the project. They truly went the extra mile, ensuring they understood our needs perfectly and were always willing to invest the time to...
CTO, New Day Therapeutics
I collaborated with Mindbowser for several years on a complex SaaS platform project. They took over a partially completed project and successfully transformed it into a fully functional and robust platform. Throughout the entire process, the quality of their work...
President, E.B. Carlson
Mindbowser and team are professional, talented and very responsive. They got us through a challenging situation with our IOT product successfully. They will be our go to dev team going forward.
Founder, Cascada
Amazing team to work with. Very responsive and very skilled in both front and backend engineering. Looking forward to our next project together.
Co-Founder, Emerge
The team is great to work with. Very professional, on task, and efficient.
Founder, PeriopMD
I can not express enough how pleased we are with the whole team. From the first call and meeting, they took our vision and ran with it. Communication was easy and everyone was flexible to our schedule. I’m excited to...
Founder, Seeke
Mindbowser has truly been foundational in my journey from concept to design and onto that final launch phase.
CEO, KickSnap
We had very close go live timeline and Mindbowser team got us live a month before.
CEO, BuyNow WorldWide
If you want a team of great developers, I recommend them for the next project.
Founder, Teach Reach
Mindbowser built both iOS and Android apps for Mindworks, that have stood the test of time. 5 years later they still function quite beautifully. Their team always met their objectives and I'm very happy with the end result. Thank you!
Founder, Mindworks
Mindbowser has delivered a much better quality product than our previous tech vendors. Our product is stable and passed Well Architected Framework Review from AWS.
CEO, PurpleAnt
I am happy to share that we got USD 10k in cloud credits courtesy of our friends at Mindbowser. Thank you Pravin and Ayush, this means a lot to us.
CTO, Shortlist
Mindbowser is one of the reasons that our app is successful. These guys have been a great team.
Founder & CEO, MangoMirror
Kudos for all your hard work and diligence on the Telehealth platform project. You made it possible.
CEO, ThriveHealth
Mindbowser helped us build an awesome iOS app to bring balance to people’s lives.
CEO, SMILINGMIND
They were a very responsive team! Extremely easy to communicate and work with!
Founder & CEO, TotTech
We’ve had very little-to-no hiccups at all—it’s been a really pleasurable experience.
Co-Founder, TEAM8s
Mindbowser was very helpful with explaining the development process and started quickly on the project.
Executive Director of Product Development, Innovation Lab
The greatest benefit we got from Mindbowser is the expertise. Their team has developed apps in all different industries with all types of social proofs.
Co-Founder, Vesica
Mindbowser is professional, efficient and thorough.
Consultant, XPRIZE
Very committed, they create beautiful apps and are very benevolent. They have brilliant Ideas.
Founder, S.T.A.R.S of Wellness
Mindbowser was great; they listened to us a lot and helped us hone in on the actual idea of the app. They had put together fantastic wireframes for us.
Co-Founder, Flat Earth
Ayush was responsive and paired me with the best team member possible, to complete my complex vision and project. Could not be happier.
Founder, Child Life On Call
The team from Mindbowser stayed on task, asked the right questions, and completed the required tasks in a timely fashion! Strong work team!
CEO, SDOH2Health LLC
Mindbowser was easy to work with and hit the ground running, immediately feeling like part of our team.
CEO, Stealth Startup
Mindbowser was an excellent partner in developing my fitness app. They were patient, attentive, & understood my business needs. The end product exceeded my expectations. Thrilled to share it globally.
Owner, Phalanx
Mindbowser's expertise in tech, process & mobile development made them our choice for our app. The team was dedicated to the process & delivered high-quality features on time. They also gave valuable industry advice. Highly recommend them for app development...
Co-Founder, Fox&Fork