Best way to add unsupported devices that have a REST API


#1

I'm very new, so new in fact that I'm still waiting for my Hubitat to be delivered.
All but two of my devices appears to be supported out of the box, so I've been trying to figure out what I need to do to get those integrated.
The devices in question are Sensibo and Ambi Climate. Both have a REST API, so was wondering what the best approach is. I note that there is already a discussion regarding a Sensibo driver for Smartthings that has been modified to work with Hubitat, so will give that a try, but cannot find anything for Ambi Climate.
Is the only solution to write drivers for these devices, or is there a better way? Is there a generic driver for anything using a REST API that just involves mapping endpoints and defining capabilities? Any other solutions not involving writing of drivers from scratch?
I'm still getting my head around the differences between a driver and an app, but hopefully all will become clear once I it has arrived and I start playing. I've not had any previous experience of solutions like this so it'll be a fun learning curve, up until now my home automation has consisted of a variety of scrips I've written myself to interact directly with the devices or via 3rd party solutions. It's going to be great to have everything all in one place.


#2

Welcome to Hubitat!

Drivers are used to integrate 'Devices'. I have written several drivers and have shared them with the community. Please feel free to take a look at them to see if they help jump-start your integrations. Drivers can also be used in a Parent/Child mode if necessary. Drivers implement device Capabilities. Capabilities define a standard interface for an App to interact with a device.

Apps are typically used as the "logic" that ties devices together in some way. For example, pressing a button device results in toggling a light device.

However, Apps can also be used to create Child devices, and are sometimes appropriate to use in place of a 'Parent' Device.

Personally, if I am integrating a new device, I try to always try to do so using an Driver.

Feel free to look through my GitHub repository to help get some ideas. Once you get your head around the architecture, the code is pretty straightforward.

Note: If you do decide to use any of my code as a starting point, all I ask if that you mention you did so in the comments of your code.

Again, welcome to Hubitat!


#3

For Ambi Client, there is an existing (limited?) SmartThings integration that can be ported over or used for technical detail. ASK THE AUTHOR FIRST.

Another method is to look at IFTTT Integration for Ambi Client. They have some capabilities and it is easy to set up IFTTT to Hubitat comms and then create a simple driver that controls the client.


#4

Thanks for the explanation and the example code, that helps a lot, really appreciate it. Once it arrives I'll have a play. As you said, once I get my head around the architecture and how everything fits together, the code is the easy part.
I don't generally copy+paste other people's code, I prefer to use as a guide and work it out for myself, but the occasions I do credit is always given if I'm making anything public.


#5

Thanks. I'll hunt out the SmartThings code to at least give me an initial guide. The API interface for Ambi Climate allows me to do everything I need to do as I have already written scripts in python, just need to learn me some groovy and how to structure for hubitat.