3rd Party Integrations
Any IoT system these days isn't complete without 3rd party integrations. With this in mind, we have added Alexa and Google Voice Assistant (GVA) integrations to ESP RainMaker.
How does this work?
ESP RainMaker has a concept of devices and parameters and there are some standard types predefined for common use cases like switches and lightbulbs. We have now created a layer which maps these parameters to formats that are understood by Alexa and GVA. So a device type in RainMaker (like light, switch, etc.) maps to a similar device type there, and their parameters like power, brightness, hue, saturation, intensity. etc. get mapped to the corresponding capabilities/traits. If you have just the power and brightness params, you get a simple brightness controllable light. If you include hue, saturation and intensity, you get a color light in Alexa and GVA.
The code required to implement the standard devices is very simple. Let us look at a colour light example (led_light) which is already available on GitHub. The relevant code snippet below is self explanatory.
/* Create a standard lightbulb (internally adds name and power as mandatory parameters */ light_device = esp_rmaker_lightbulb_device_create("Light", NULL, DEFAULT_POWER); esp_rmaker_device_add_cb(light_device, write_cb, NULL); /* Add the standard brightness parameter */ esp_rmaker_device_add_param(light_device, esp_rmaker_brightness_param_create("brightness", DEFAULT_BRIGHTNESS)); /* Add the standard hue parameter */ esp_rmaker_device_add_param(light_device, esp_rmaker_hue_param_create("hue", DEFAULT_HUE)); /* Add the standard saturation parameter */ esp_rmaker_device_add_param(light_device, esp_rmaker_saturation_param_create("saturation", DEFAULT_SATURATION)); esp_rmaker_node_add_device(node, light_device);
The switch example on GitHub is also ready out of the box for Alexa/GVA. Once you build and flash the Lightbulb/Switch example, provision your board and link to your account using the ESP RainMaker Phone apps. Give the device some friendly name so that it is easy to identify.
- Open the Alexa app on your phone, go to Skills and Games in the menu and search for "ESP RainMaker".
- Select the skill, tap on "Enable to Use" and provide your RainMaker credentials.
- Once the account linking is successful, allow Alexa to discover your devices.
- Once the devices are successfully discovered, the setup is complete and you can start controlling them using Alexa.
Enabling Google Voice Assistant (GVA)
- Open the Google Home app on your phone.
- Tap on "+" -> Set up Device.
- Select the "Works with Google" option meant for devices already set up.
- Search for ESP RainMaker and sign in using your RainMaker credentials.
- Once the Account linking is successful, your RainMaker devices will show up and you can start using them.