This post is part of the series Forced Root Cause Monitoring via Mashups and Modal Popups
To not feel lost or out of context, it's recommended to read the main post first.
Create Entities
AlertStateDefinition
- Create a new StateDefinition called "rcp_AlertStateDefinition"
- In the State Information tab, select Apply State: Numeric from the list on the right hand side
- Create a new State:
- Less than or equal to "1"
- Display Name: "Something good"
- Style: a new custom style with text color #f5b83d (orange)
- Create a new State:
- Less than or equal to "2"
- Display Name: "Something bad"
- Style: a new custom style with text color #f55c3d (red)
- Create a new State:
- Less than or equal to "3"
- Display Name: "Something ugly"
- Style: a new custom style with text color #ad1f1f (red) with a Font Bold
- Edit the "Default" State
- Set the Style: a new custom style with text color #36ad1f (green)
- We will not use this style, but in case we need a default configuration it will blend into the color schema
- Save the StateDefinition
ValueStream
- Create a new ValueStream called "rcp_ValueStream" (choose a default ValueStream, not a RemoteValueStream)
- Save the ValueStream
AlertThing
- Create a new Thing called "rcp_AlertThing"
- Based on a Generic Thing Base Thing Template
- Using the rcp_ValueStream Value Stream
- In the Properties and Alerts tab create the following Properties
- Name: "trigger"
- Base Type: BOOLEAN
- With a Default Value of "false"
- Check the "Persistent" checkbox
- Name: "selectedReason"
- BaseType: NUMBER
- Check the "Persistent" checkbox
- Check the "Logged" checkbox
- Advanced Settings: Data Change Type: ALWAYS
- In the Services tab create a new Service
- Name: "clearTrigger"
- No Inputs and no Outputs
- Service code
me.trigger = false;
- When this service is executed, it will set the trigger Property to false
- Click Done to complete the Service creation
- Save the Thing