<div> <h5>normal button faces below:</h5> <ch5-button type="danger" label="Danger"></ch5-button> <ch5-button type="text" label="Text"></ch5-button> <ch5-button type="warning" label="Warning"></ch5-button> <ch5-button type="info" label="Info"></ch5-button> <ch5-button type="success" label="Success"></ch5-button> <ch5-button type="default" label="Default"></ch5-button> <ch5-button type="primary" label="Primary"></ch5-button> <ch5-button type="secondary" label="Secondary"></ch5-button> </div> <br/> <div> <h5>selected button faces below:</h5> <ch5-button selected type="danger" label="Danger"></ch5-button> <ch5-button selected type="text" label="Text"></ch5-button> <ch5-button selected type="warning" label="Warning"></ch5-button> <ch5-button selected type="info" label="Info"></ch5-button> <ch5-button selected type="success" label="Success"></ch5-button> <ch5-button selected type="default" label="Default"></ch5-button> <ch5-button selected type="primary" label="Primary"></ch5-button> <ch5-button selected type="secondary" label="Secondary"></ch5-button> </div>
Crestron Components Lib - Showcase App
ch5-button: type
normal button faces below:
selected button faces below:
<div> <h5>The type attribute is changed for the button below:</h5> <ch5-button type="danger" label="Danger" receivestatetype="current_type"></ch5-button> </div> <br /><br /> <div> <h5>Change the above button type attribute by clicking on the below buttons:</h5> <ch5-button type="primary" sendeventonclick="trigger_type_change_primary" label="Primary"></ch5-button> <ch5-button type="danger" sendeventonclick="trigger_type_change_danger" label="Danger"></ch5-button> <ch5-button type="success" sendeventonclick="trigger_type_change_success" label="Success"></ch5-button> <ch5-button type="warning" sendeventonclick="trigger_type_change_warning" label="Warning"></ch5-button> </div> <br/>
Emulator actions
Press the Load button to load the scenario. This will also reload all of the existing examples on the page.
Press the Run button to run the scenario. You only need to do this if the scenario (the json) has an onStart key.
Events and states
The Emulator Scenario JSON contains an array of cues and an optional array onStart.
→ A cue is defined by: type:string, event:string, trigger:boolean|string|number,
actions:array
→ An action is defined by: type:string, state:string, logic:string ... plus
other
fields ( depending on type)
The value of the state or event for a cue or for an action is a string which represents the name of that state or action.
Type field
The type for cue or for action can be the string:
- b or boolean - for a boolean state or event
- n or number or numeric - for a number state or event
- s or string - for a string state or event
- o or object - for an object state or event
Trigger field
The trigger can be either a fixed value of the same type as the state or event, or the string "&change". If it is a fixed value then, when the emulator detects that the state or event has changed to the value given in trigger, it also executes the actions for that state or event. If the value is the string is "&change", regardless of state or event type, the actions are executed on any change in the value of the state or event.
Logic Field
The logic can be:
- link - passes the value received on the incoming join through to the outgoing join. Using this between incompatible join types will attempt to cast the value. In the event of a cast failure, the value will be set to false, 0 or "" (empty string).
- set - assigns a specific value to the join. This requires a 5th key of 'value' and the specific
value to assign. ie.
{"state":"light_level", "type":"n", "logic": "set","value":5}. If the 5th key is omitted, the default value will be sent (false, 0, "" or {}). - toggle - (boolean Only) reads the current state and changes it to the opposite state.
- pulse - (boolean Only) value goes high and then low.
- increment - (Numeric Only) reads the current value of the analog and adds an offset.
This logic accepts an optional 5th key of 'offset which determines how many times to increment by. ie.
{"event":"volume_level","type":"n", "logic":"increment","offset":5}. If this 5th key is omitted, the default offset of 1 will be applied. - decrement - (Numeric Only) reads the current value of the analog and subtracts an offset. This logic
accepts an optional 5th key of 'offset which determines how many times to decrement by. ie.
{"event":"volume_level","type":"n", "logic":"decrement","offset":5}. If this 5th key is omitted, the default offset of 1 will be applied. -
RCB logic can be accomplished by defining an action containing an object state or event of RCB type.
A 5th key is expected as the amount of time in
milliseconds to reach the level.
{"signal":"light_level", "type":"n", "logic": "rcb","value":65535, "time":2000}
{ "rcb":{ "value": numeric_value, "time": duration_in_ms } }
Scenario example:
{
"cues": [
{
"type": "boolean",
"event": "trigger",
"trigger": true,
"actions": [
{
"state": "action1",
"type": "boolean",
"logic": "toggle"
},
{
"state": "rcb_signal",
"type": "object",
"logic": "set",
"value": {
"rcb":{
"value": 101,
"time": 1500
}
}
}
]
}
],
"onStart": [
]
}
The type attribute is changed for the button below:
Change the above button type attribute by clicking on the below buttons:
<h5>Change the mode below from "0" to "1" in the 'HTML' editor.</h5> <br/> <ch5-button mode="0" stretch="width" label="Verify Type for ch5-button-mode" type="danger"> <ch5-button-mode type="default" iconClass="fa fa-play"></ch5-button-mode> <ch5-button-mode type="warning" iconClass="fas fa-pause"></ch5-button-mode> </ch5-button> <hr/> <h5>Change the mode (receiveStateMode) by clicking on the '+ Mode' / '- Mode' button.</h5> <br/> <ch5-button type="primary" sendeventonclick="trigger_type_increment_mode" iconClass="fas fa-plus" label="Mode"></ch5-button> <ch5-button type="primary" sendeventonclick="trigger_type_decrement_mode" iconClass="fas fa-minus" label="Mode"></ch5-button> <br/><br/> <ch5-button receiveStateMode="current_mode" stretch="width" label="Verify Type for ch5-button-mode" type="danger"> <ch5-button-mode type="success" iconClass="fa fa-play"></ch5-button-mode> <ch5-button-mode type="warning" iconClass="fas fa-pause"></ch5-button-mode> <ch5-button-mode type="danger" iconClass="fab fa-amilia"></ch5-button-mode> <ch5-button-mode type="text" iconClass="fas fa-anchor"></ch5-button-mode> <ch5-button-mode type="info" iconClass="fas fa-battery-quarter"></ch5-button-mode> <ch5-button-mode type="primary" iconClass="fas fa-at"></ch5-button-mode> <ch5-button-mode type="secondary" iconClass="fab fa-apple"></ch5-button-mode> </ch5-button>
Emulator actions
Press the Load button to load the scenario. This will also reload all of the existing examples on the page.
Press the Run button to run the scenario. You only need to do this if the scenario (the json) has an onStart key.
Events and states
The Emulator Scenario JSON contains an array of cues and an optional array onStart.
→ A cue is defined by: type:string, event:string, trigger:boolean|string|number,
actions:array
→ An action is defined by: type:string, state:string, logic:string ... plus
other
fields ( depending on type)
The value of the state or event for a cue or for an action is a string which represents the name of that state or action.
Type field
The type for cue or for action can be the string:
- b or boolean - for a boolean state or event
- n or number or numeric - for a number state or event
- s or string - for a string state or event
- o or object - for an object state or event
Trigger field
The trigger can be either a fixed value of the same type as the state or event, or the string "&change". If it is a fixed value then, when the emulator detects that the state or event has changed to the value given in trigger, it also executes the actions for that state or event. If the value is the string is "&change", regardless of state or event type, the actions are executed on any change in the value of the state or event.
Logic Field
The logic can be:
- link - passes the value received on the incoming join through to the outgoing join. Using this between incompatible join types will attempt to cast the value. In the event of a cast failure, the value will be set to false, 0 or "" (empty string).
- set - assigns a specific value to the join. This requires a 5th key of 'value' and the specific
value to assign. ie.
{"state":"light_level", "type":"n", "logic": "set","value":5}. If the 5th key is omitted, the default value will be sent (false, 0, "" or {}). - toggle - (boolean Only) reads the current state and changes it to the opposite state.
- pulse - (boolean Only) value goes high and then low.
- increment - (Numeric Only) reads the current value of the analog and adds an offset.
This logic accepts an optional 5th key of 'offset which determines how many times to increment by. ie.
{"event":"volume_level","type":"n", "logic":"increment","offset":5}. If this 5th key is omitted, the default offset of 1 will be applied. - decrement - (Numeric Only) reads the current value of the analog and subtracts an offset. This logic
accepts an optional 5th key of 'offset which determines how many times to decrement by. ie.
{"event":"volume_level","type":"n", "logic":"decrement","offset":5}. If this 5th key is omitted, the default offset of 1 will be applied. -
RCB logic can be accomplished by defining an action containing an object state or event of RCB type.
A 5th key is expected as the amount of time in
milliseconds to reach the level.
{"signal":"light_level", "type":"n", "logic": "rcb","value":65535, "time":2000}
{ "rcb":{ "value": numeric_value, "time": duration_in_ms } }
Scenario example:
{
"cues": [
{
"type": "boolean",
"event": "trigger",
"trigger": true,
"actions": [
{
"state": "action1",
"type": "boolean",
"logic": "toggle"
},
{
"state": "rcb_signal",
"type": "object",
"logic": "set",
"value": {
"rcb":{
"value": 101,
"time": 1500
}
}
}
]
}
],
"onStart": [
]
}
Change the mode below from "0" to "1" in the 'HTML' editor.
Change the mode (receiveStateMode) by clicking on the '+ Mode' / '- Mode' button.
<h5>Click on the button to see the change of 'type' attribute based on 'state'.</h5> <br/> <ch5-button label="Verify Type for Mode State" stretch="width" type="text" mode="0" receivestateselected="receive_selected_state" sendeventonclick="trigger_set_selected_state"> <ch5-button-mode type="secondary"> <ch5-button-mode-state state="normal" iconclass="fa fa-play" type="warning"></ch5-button-mode-state> <ch5-button-mode-state state="pressed" iconclass="fa-2x fas fa-circle-notch" type="info"></ch5-button-mode-state> <ch5-button-mode-state state="selected" iconclass="fas fa-pause" type="success"></ch5-button-mode-state> </ch5-button-mode> </ch5-button>
Emulator actions
Press the Load button to load the scenario. This will also reload all of the existing examples on the page.
Press the Run button to run the scenario. You only need to do this if the scenario (the json) has an onStart key.
Events and states
The Emulator Scenario JSON contains an array of cues and an optional array onStart.
→ A cue is defined by: type:string, event:string, trigger:boolean|string|number,
actions:array
→ An action is defined by: type:string, state:string, logic:string ... plus
other
fields ( depending on type)
The value of the state or event for a cue or for an action is a string which represents the name of that state or action.
Type field
The type for cue or for action can be the string:
- b or boolean - for a boolean state or event
- n or number or numeric - for a number state or event
- s or string - for a string state or event
- o or object - for an object state or event
Trigger field
The trigger can be either a fixed value of the same type as the state or event, or the string "&change". If it is a fixed value then, when the emulator detects that the state or event has changed to the value given in trigger, it also executes the actions for that state or event. If the value is the string is "&change", regardless of state or event type, the actions are executed on any change in the value of the state or event.
Logic Field
The logic can be:
- link - passes the value received on the incoming join through to the outgoing join. Using this between incompatible join types will attempt to cast the value. In the event of a cast failure, the value will be set to false, 0 or "" (empty string).
- set - assigns a specific value to the join. This requires a 5th key of 'value' and the specific
value to assign. ie.
{"state":"light_level", "type":"n", "logic": "set","value":5}. If the 5th key is omitted, the default value will be sent (false, 0, "" or {}). - toggle - (boolean Only) reads the current state and changes it to the opposite state.
- pulse - (boolean Only) value goes high and then low.
- increment - (Numeric Only) reads the current value of the analog and adds an offset.
This logic accepts an optional 5th key of 'offset which determines how many times to increment by. ie.
{"event":"volume_level","type":"n", "logic":"increment","offset":5}. If this 5th key is omitted, the default offset of 1 will be applied. - decrement - (Numeric Only) reads the current value of the analog and subtracts an offset. This logic
accepts an optional 5th key of 'offset which determines how many times to decrement by. ie.
{"event":"volume_level","type":"n", "logic":"decrement","offset":5}. If this 5th key is omitted, the default offset of 1 will be applied. -
RCB logic can be accomplished by defining an action containing an object state or event of RCB type.
A 5th key is expected as the amount of time in
milliseconds to reach the level.
{"signal":"light_level", "type":"n", "logic": "rcb","value":65535, "time":2000}
{ "rcb":{ "value": numeric_value, "time": duration_in_ms } }
Scenario example:
{
"cues": [
{
"type": "boolean",
"event": "trigger",
"trigger": true,
"actions": [
{
"state": "action1",
"type": "boolean",
"logic": "toggle"
},
{
"state": "rcb_signal",
"type": "object",
"logic": "set",
"value": {
"rcb":{
"value": 101,
"time": 1500
}
}
}
]
}
],
"onStart": [
]
}