Enhancing Functionality with IoT Studio User Functions
In addition to basic control through MQTT, extra logic can be defined in the IoT platform to automate actions based on the data received from sensors.
User Functions provide the capability to execute custom business rules by writing
                code, and automatically deploying the code without provisioning servers, building an
                API, or maintaining the infrastructure.
        Note: To access the
                    data stored in AnythingDB to build some logic using the user Functions you will
                    first need to create an App (an App is a set of permissions needed to ensure
                    that the access to data is secure and that the user is authorized to perform the
                    request).
- Click and create a new App by following these steps.
 - For this project, choose all the scopes so the app can be used for any purpose.
 - 
                Access the Authorization tab and add role::root. 
                This will allow all the sections and resources of your application to read, create, update and delete.
 - 
                As the App Client ID and Client
                        Secret are required in the functions, you should save them in
                    the Variables Storage section under Space
                        Settings. Make sure you enable the Function
                        Access.
                Tip: To use the codes that are part of this project, make sure you have stored the app credentials as a variable called
master-app. - 
                Below are sample codes to define logic rules or automated events:
                Note: Make sure you enter your own values for
spaceandthing_uidon each code.