|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
− | {{DISPLAYTITLE:Rule-5.0}}
| |
− | {{Top}}<h1><big>Rule Machine<sup>®</sup> 5.0</big></h1><big>Rule-5.0 is the culmination of a journey in the transformation of the Rule Machine app. All at once, it simplifies and adds power, resulting in a fully generalized automation engine. The prior top-level organization of Rule Machine has been replaced with an optimized interface. The changes described below, explain how prior rules were created versus how it is accomplished with Rule-5.0. The former structure of Rules, Triggers, Triggered Rules, Actions and Schedules are now replaced with the definition of what causes a rule to run, and the resulting action. The former Button Controller app is now incorporated into Rule Machine, but with increased power and flexibility. New conditional logic capabilities are provided, allowing the most subtle or complex automations to be created. You simply define what causes the a rule to run, and then that you want it to do.</big>
| |
− | ===<big>Logic in a Rule-5.0 rule</big>===
| |
− | <big>In any Rule, the rule itself can be thought of as an overarching '''IF-THEN-ELSE''', where if the condition was '''True''' for the '''IF''' part or the rule, then '''Actions for True''' are run, and if they are '''False''', then '''Actions for False''' are run. In '''Rule-5.0''', this same logic can now simply be done with the '''Conditional Actions''' of '''IF-THEN and ELSE''' in the '''Actions''' section of a rule. As described in the next section, '''IF-THEN''' now has the same full logical expression capability previously available, with the addition of '''AND, OR, XOR, NOT''' logical operators, and nested parenthetical sub-expressions.</big>
| |
| | | |
− | *<big>'''Example:''' Using a Trigger Event such as a contact sensor '''Front Door *changed*''' to illustrate the difference, the previous Rule Machine version used this to interpret the '''Condition of Front Door *open*.''' The rule was evaluated whenever '''any''' event happened for the Front Door. In Rule-5.0, this is explicit, whereas in previous versions the rule was '''Front Door *open*''', we now make that event the Condition of an '''IF-THEN''' action. What were formerly '''Actions for True''', now become the Actions following '''IF-THEN''', and the former '''Actions for False''' become the actions following '''ELSE'''. Most Rules will now follow this basic format.</big>
| + | <big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big> |
| | | |
− | ===<big>Rule Triggers</big>===
| + | <big> |
− | <big>All "Rules" in Rule-5.0 are in effect '''Triggered Rules'''. They each have a '''Trigger Event''', and then '''Conditional Actions'''. Instead of a rule with '''Actions for True''' and '''Actions for False''', they simply use conditional logic in the actions to create an equivalent '''IF-THEN-ELSE''' structure.</big>
| + | This document is available at: http://docs2.hubitat.com/en/apps/rule-machine/rule-5-0 |
− | ===<big>Events</big>===
| + | </big> |
− | <big>Each rule can have one or more '''Trigger Events''' that when triggered, cause the rule's actions to run.</big><p><big>Events are created by the devices or conditions in your system. Each device creates events appropriate to the type of device. A '''Trigger Event''' listens for specific events and when a trigger receives a selected event, it causes the defined '''Actions''' to run.</big></p><p><big>Rule Machine allows the following events in a Hubitat Elevation system to be acted upon. Each event results in a single test and the supported events and states that can be tested are listed below. For each event that refers to a device, one or more devices can be selected, and then the device state required for the '''Condition''' to be met can be selected. When multiple devices are selected, the Condition/Event may apply for '''ANY''' (default) or '''ALL''' of the devices.</big></p><pre>Acceleration: active / inactive
| |
− | Between two dates: starting month on this date / ending month on this date
| |
− | Battery: value
| |
− | Button: pressed / held / doubleTapped / released
| |
− | Button Device: select actions for any buttons of a button device
| |
− | Certain Time: at a certain time, including sunrise / sunset with offset
| |
− | Cloud End Point: hitting URL fires
| |
− | Contact: open / closed
| |
− | Custom attribute: device capability
| |
− | Days of Week: on certain days of the week
| |
− | Dimmer level: value
| |
− | Door: open, closed, opening, closing, unknown
| |
− | Energy meter: value
| |
− | Garage door: open, closed, opening, closing, unknown
| |
− | HSM alert: intrusion, intrusion-delay, intrusion-home, intrusion-home-delay, intrusion-night, cancelRuleAlerts, intrusion-night-delay,
| |
− | smoke, water, rule, arming, armingHome, armingNight, cancel
| |
− | HSM status: armed away, armed home, armed night, delayed arming home, delayed arming night, delayed arming away, disarmed, all disarmed
| |
− | Humidity: value
| |
− | Illuminance: value
| |
− | Last Event Device select device and attribute
| |
− | Local End Point: hitting URL fires
| |
− | Lock: locked / unlocked
| |
− | Mode: any of your hub's modes
| |
− | Motion: active / inactive
| |
− | Music player: playing, paused, stopped
| |
− | Periodic: allows periodic schedules for minutes, hourly, daily, weekly, monthly or yearly
| |
− | Physical dimmer level: value
| |
− | Physical switch: on / off
| |
− | Power meter: value
| |
− | Power source: mains / battery
| |
− | Presence: present / not present or arrives / leaves
| |
− | Private Boolean: true / false
| |
− | Rule paused: rule
| |
− | Smoke detector: clear, detected, tested
| |
− | Switch: on / off
| |
− | Temperature: value
| |
− | Thermostat cool setpoint: value
| |
− | Thermostat fan mode: value
| |
− | Thermostat heat setpoint: value
| |
− | Thermostat mode: heat / cool / auto / off / emergency heat
| |
− | Thermostat state: heating / cooling / fan only / idle / pending heat / pending cool
| |
− | Time of day: specific time / sunrise / sunset
| |
− | Variable: value
| |
− | Water sensor: dry / wet
| |
− | | |
− | Note: value means compare current value to a number, to another device with an offset, or to a variable with an offset, or changed, increased, decreased</pre>
| |
− | ===<big>Actions</big>===
| |
− | <big>Actions are the portion of a rule that defines what the rule does when it is triggered to run.</big>
| |
− | ====<big>Actions as ordered script</big>====
| |
− | <big>As you define actions, you are creating a script of actions to perform when the rule runs. You may use as many actions as you want for each '''Action''' type and they can be run in whatever order you want. There is no predefined order of execution for Rule Machine actions, so you may arrange the order of actions any way you want. You can insert a new action anywhere in the list of actions, or at the end of the list.</big>
| |
− | ====<big>Actions can be modified</big>====
| |
− | <big>The Rule-5.0 user interface provides the ability to '''Edit''' and '''Delete''' any action you have defined, giving you complete control over your list of actions.</big>
| |
− | [[File:Rule-5.0 Edit and Delete Actions.png|none|thumb|600x600px]]
| |
− | <big>You may also '''Cut''' and then '''Paste''' actions if you need them to occur in a different order.</big>
| |
− | | |
− | #Select the action to cut.
| |
− | #Choose the new position for the action you just cut. The desired position could also be the end of the action list by choosing to paste the action before '''**End of Actions**''', which would paste the cut action at the end of the action list.[[File:Rule-5 cut action.png|none|thumb|600x600px]][[File:Rule-5.0 Paste Action Before v2.png|none|thumb|600x600px]][[File:Rule-5 action position after paste action.png|none|thumb|600x600px]]
| |
− | | |
− | ====<big>Delay Actions and Delay Actions per Mode</big>====
| |
− | <big>All actions can be delayed, effectively pausing the action execution for a specified amount of time. A</big><big>ctions</big> <big>may</big> <big>also be delayed for a period of time that is dependent on the current '''Mode''' by using '''Delay Actions Per Mode'''.</big>
| |
− | | |
− | <big>'''Delay per Action'''</big>
| |
− | | |
− | <big>Each action you define can have an optional delay. These delays can be defined with hours, minutes, and seconds. Seconds can have decimal fractions, allowing millisecond resolution. In a rule, delays can have the '''option to be cancelled''' in the event of a change of rule truth. It is important to realize that the delay assigned to an individual action affects only that action, and not subsequent actions. Any subsequent action is executed immediately after the delayed action starts its delay timer, and does not wait for that delay timer to run. When the delay timer expires, the delayed action is executed (unless the delay was cancelled).</big>
| |
− | [[File:Rule Machine Delay per action.png|none|thumb|600x600px]]
| |
− | <big>'''Delay all Actions'''</big>
| |
− | | |
− | <big>It is also possible to delay all actions (also with optional cancel). The script of actions runs sequentially when the rule runs, with each action happening in order. Actions with delays start their timer, which can vary for each action, and '''<u>the next action in order</u>''' runs. By using '''Delay Actions''', the entire script can be ''paused'' by a delay.</big>
| |
− | | |
− | <big>'''Delay Actions per Mode'''</big>
| |
− | | |
− | <big>Delay Actions can also be specified on a per mode basis, so that the time the script is paused, varies according to the current mode.</big>
| |
− | ===<big>Rule-5.0 Conditional Actions and Logical Expressions</big>===
| |
− | <big>In Rule Machine, '''IF-THEN-ELSE-ENDIF''' conditional blocks can be nested. The user interface utilizes textual indentation to help guide you in keeping track of which '''IF-THEN-ELSE-ENDIF''' block you are currently adding actions to. The user is responsible for completing each level of nested '''IF-THEN''' blocks.</big>
| |
− | | |
− | <big>The condition of an '''IF-THEN''' or '''ELSE-IF''' Action can be a full logical expression built-up from individual conditions, and the logical operators '''AND''', '''OR''', '''XOR''', and '''NOT'''. Parenthesized sub-expressions are also possible. This is the same user interface of the former rule portion found in Rule or Triggered Rule from Rule-3.0. An individual '''Condition''' can be created ''on the fly'' while defining a logical expression. Every such '''Condition''' is kept in the list of available Conditions. This list of available conditions is present in the '''Define Actions''' page. The user interface then allows Creating, Editing and Deleting conditions. If a condition is edited, those changes will be reflected where it is used in an '''IF-THEN''' or '''ELSE-IF''' conditional action.</big>
| |
− | | |
− | <big>This combination of nested '''IF-THEN''' blocks and full logical expression for each '''IF-THEN''' and '''ELSE-IF''', allows creativity for rules in Rule-5.0 that is limited only by your imagination. To help you with complex logic structures, new actions are available.</big>
| |
− | | |
− | #<big>Exit Rule - With Exit Rule the execution of '''Actions''' for that rule will stop, irrespective of what order in the rule it exists.</big>
| |
− | #<big>Pending Delays are not cancelled, and current Repetitions are not stopped by Exit Rule, but these can be managed separately if needed with '''Stop Repeating Actions''', '''Cancel Rule Timers''', and '''Cancel Delayed Actions''', where appropriate.</big>
| |
− | | |
− | ====<big>Automatic Condition Creation</big>====
| |
− | <big>When '''Event Triggers''' are defined, corresponding conditions are created for most types. Some conditions, like '''Button''', '''Certain Time''', etc, do not have a ''state'' and so have no corresponding condition. These created conditions are available in the '''Define Actions''' page for use in '''Conditional Actions''', are available for use in other Actions, and can be edited.</big>
| |
− | | |
− | ====<big>IF-THEN-ELSE</big>====
| |
− | <big>You can introduce conditional execution of actions using the following method.</big>
| |
− | IF (condition) THEN
| |
− | some actions...
| |
− | ELSE-IF (condition) THEN
| |
− | some actions...
| |
− | ELSE
| |
− | some actions...
| |
− | END-IF
| |
− | <big>'''IF-THEN''' and '''ELSE-IF''' both accept a logical expression as described above and '''IF-THEN-ELSE''' may also be nested. If the expression on the '''IF''' portion is True, then those actions following '''IF''' and before any '''ELSE-IF''' or '''ELSE''' statements will be carried out. If the expression is False, then those actions are skipped, and the '''ELSE''' portion or '''ELSE-IF''' are carried out. In the case of '''ELSE-IF''', its expression will be tested, and the following Actions that follow it will either run or will not run, depending on the result of the evaluation. There can be as many '''ELSE-IF''' sections as you need, and the '''ELSE-IF''' and '''ELSE''' portions are both are optional. '''END-IF''' is also optional, and if omitted means all remaining actions are part of the preceding '''IF-THEN''', '''ELSE-IF''' or '''ELSE'''. However, for good rule structure, just a sentence should have a period at the end, it is strongly recommended that you use END-IF to complete an '''IF-THEN-ELSE''' as a regular practice.</big>
| |
− | ===<big>Repeat Actions</big>===
| |
− | <big>Portions of, or all of the script of an '''Action''' can be repeated periodically, but you must specify the time interval for the repetition. Be careful not to make this interval too short, as you can consume your hub CPU resources by repeating too quickly. You can select any number of iterations if desired, but some method to stop the repetition is required. When a '''Repeat Actions''' is introduced to the script, any action before '''END-REP''' will be repeated. Only the Actions between '''Repeat Actions''' and '''END-REP''' will be repeated. Actions following '''END-REP''' will run only once the repetition has stopped. There is an optional '''Stop for a Repeat Action''' choice and if selected, then '''Stop Repeating Actions''' will stop this repetition. Using '''Cancel Rule Timers''' from either the current rule or another rule, will stop '''<u>all Repeat Actions</u>''', irrespective of which Stop selection is used.</big>
| |
− | Repeat Actions
| |
− | some actions...
| |
− | END-REP
| |
− | <big>A '''Repeat Actions''', like any action, can have a condition specified. If the condition is False, the '''Repeat Actions''' block will not be executed. If the condition becomes False during repetition, the repetition will be stopped (with the exception of when '''Repeat N Times''' is selected). This provides three features well known to computer programmers.</big>
| |
− | | |
− | #<big>While-loop - The '''while-loop''' runs only if the condition is true, and stops if it is false.</big>
| |
− | #<big>For-loop - A '''for-loop''' runs for a fixed number of times, but if a condition exists, it will only start that iteration if the condition is true; The condition is not retested during iteration.</big>
| |
− | #<big>Repeat-until loop - A repeat-until loop runs until a condition becomes true, running at least once.</big>
| |
− | | |
− | '''<big>Examples:</big>'''
| |
− | | |
− | ''<big>While loop - repeat while the condition is True:</big>''
| |
− | IF (condition) Repeat Actions
| |
− | some actions...
| |
− | END-REP
| |
− | ''<big>For loop (repeat n times):</big>''
| |
− | Repeat Actions n times
| |
− | some actions...
| |
− | END-REP
| |
− | ''<big>Conditional For loop (repeat n times if condition is True):</big>''
| |
− | IF (condition) Repeat Actions n times
| |
− | some actions...
| |
− | END-REP
| |
− | ''<big>Repeat-Until loop:</big>''
| |
− | Repeat Actions with Stop selected
| |
− | some actions
| |
− | IF (condition) Stop Repeating Actions
| |
− | END-REP
| |
− | <big>'''Repeat Actions''' cannot be nested. '''END-REP''' is optional, and if omitted, all actions after '''Repeat Actions''' will be repeated.</big>
| |
− | | |
− | *<big>'''Note''': The '''END-REP''' does not have anything to do with the when a '''Repeated Action''' will stop repeating, it merely marks the end of the list of actions to be repeated. If you use '''Repeat These Actions''' without specifying '''N Times''' (for loop), and without a '''Condition''' (while loop), and also without a '''Conditional Stop''' or a '''Stop on Truth Change''' (for rules only), that means it should repeat <u>forever</u>, and that is probably not what you want to have happen. In that case, some other rule would need to cause the repetition to stop.</big>
| |
− | | |
− | ===<big>Wait for Events and Wait for Conditions</big>===
| |
− | <big>'''Wait for Events''' and '''Wait for Conditions''' may be using with Conditional Actions and in a '''Simple Conditional Action'''. Additionally, '''Wait for Conditions''' allows for full logical expression with operators '''AND''', '''OR''', or '''XOR.''' If the conditions are true, no wait occurs, otherwise the rule execution is paused until the conditions are met.</big> <big>Both '''Wait for Events''' and '''Wait for Conditions''' have the option to select a '''Timeout''' period. Multiple events can be defined to cause the Wait to end. In effect, this introduces another trigger-like capability into the Actions. There is also an event type specifically for '''Wait for Events''' named '''Elapsed Time'''. When the '''Elapsed Time''' expires, the wait will be over, irrespective of other events it may be waiting for. Pending '''Wait for Events''' and '''Wait for Conditions''' will be cancelled each time a rule is triggered, and can be also cancelled by another rule with '''Stop Rule Actions''', or by a '''Cancel Wait''' action (which presumably would have been part of a Delayed Action).</big>
| |
− | | |
− | <big>'''Wait for Conditions''' also has an option to use '''Duration''' instead of a '''Timeout''' period, allowing you to specify an amount of time that the Conditions must remain continuously true for the Wait to conclude. This is useful for many automations that require the passage of some time in a certain state, such as a door that has been left open for more than 5 minutes. The rule would '''Wait for Conditions''' that the door is open for a duration of 5 minutes, Following the Wait period, you could have a notification action. If the door was subsequently closed before the 5 minute duration period, the Wait wouldn't conclude. If the door opened again, the pending Wait would then be canceled, and a new one begins. Only if the door is opened and remains open for 5 minutes would the Wait conclude, and the notification be sent.</big>
| |
− | [[File:Wait for conditions example.png|none|thumb|600x600px]]
| |
− | | |
− | *<big>'''NOTE:''' In cases where a rule’s trigger event is closely related to the Conditions, such as in the above example of a door remaining open, two subscriptions will fire. One subscription will be for the '''Trigger''', and one for the pending Wait. The trigger will win, thus canceling the pending wait, but if logging is enabled you will find both outcomes of the event in the logs. It is important to <u>never use</u> a *changed* trigger with '''Wait for Conditions''' on a related event, since it would result in a re-trigger after every event related to the Conditions, and the Wait would never conclude because would be cancelled by the *changed* trigger.</big>
| |
− | | |
− | ===<big>Custom Actions</big>===
| |
− | <big>A Custom Action allows you to select a device, and send any of the commands that device supports along with parameters it may take. '''Custom Actions''' are created within your actions and they are specific to the rule where created.</big>
| |
− | | |
− | === <big>Hub Variables</big> ===
| |
− | <big>Hub Variables are a setting for creating very efficient variables directly in the hub for use in other apps, not just in Rule Machine, as is the case with Local Variables. There are five types of Hub Variables available - '''Number''', '''Decimal''', '''String''', '''Boolean''' and '''DateTime'''.</big>
| |
− | | |
− | <big>Each Hub Variable can have an associated '''Connector'''. A Connector is a virtual device linked to the Hub Variable. When the Hub Variable value changes, so does the Connector value, and vice versa. When the Connector device is set to a different value, the corresponding Hub Variable is set to that value. Connectors can be used in any app. The aforementioned '''DateTime''', allows '''both''' Date and Time to be set. The use of Date has very limited applicability for now, specifically in the Certain Time trigger for Rule 5.0, where triggering on a specific date is possible; by using a '''DateTime''' connector, that can be a variable Date and Time.</big>
| |
− | | |
− | <big>Managing '''Hub Variables''' can be found in Settings, allowing for the creation of a Hub Variable, changing its value, creating a '''Connector''' for it, and removing it. If a Hub Variable is in use by an app, the name of the Hub Variable is shown in '''<span style="color: red;;">Orange</span>''', and selecting that shows the apps it is in use by. When a Connector is created, the type of Connector is shown in '''<span style="color: red;;">Blue</span>''', and selecting that connector opens a new tab with the Connector device settings page. The value of the variable can be changed by selecting the '''<span style="color: red;;">Purple</span>''' text in the Value column. When a Connector exists, the variable value is shown with the selected attribute for the Connector.</big>
| |
− | | |
− | <big>'''Example:''' A Boolean variable for which a '''Switch Connector''' is created, will show '''On''' or '''Off''' as the possible values, rather than '''True''' or '''False'''.</big>
| |
− | | |
− | * <big>To '''remove a Connector''', open the device page for the Connector and remove it from that page. If the Connector is in use by any apps, be sure to clean up those apps first; the warning to do so is presented to prevent mistakes.</big>
| |
− | | |
− | * <big>To '''remove a Hub Variable''', click on Delete for that variable. If the variable is in use by an app, an appropriate warning will be provided, and those apps should be cleaned up before deleting the Hub Variable.</big>
| |
− | | |
− | ===<big>Run Actions from the Rule-5.0 User Interface</big>===
| |
− | <big>When you first create a new rule, you are creating a child app of the parent Rule Machine app, and therefor you must select '''Done''' on the main page to install the Rule-5.0 rule. If you re-open the rule, its actions can be run by hitting '''Run Actions''' button. If you change the '''Trigger Events''' in any way, you must either select '''Done''' or the '''Update Rule''' button.</big>
| |
− | | |
− | ===<big>Rule Logging</big>===
| |
− | <big>You can select which types of logging you want to see in [https://docs.hubitat.com/index.php?title=Logs Logs]. This is a very good way to determine exactly what a rule is doing.</big>
| |
− | ===<big>List of Actions</big>===
| |
− | <pre> Conditional Actions
| |
− | IF (conditions) THEN
| |
− | ELSE-IF (conditions) THEN
| |
− | ELSE
| |
− | END-IF
| |
− | Simple Conditional Action
| |
− | Control Switches, Push Buttons
| |
− | Turn switches on
| |
− | Turn switches off
| |
− | Toggle switches
| |
− | Flash switches
| |
− | Set switches per mode
| |
− | Push a button
| |
− | Push a button per mode
| |
− | Set Dimmers and Bulbs
| |
− | Set dimmer level
| |
− | Toggle dimmer level
| |
− | Adjust dimmer level
| |
− | Set dimmer level per mode
| |
− | Fade dimmer level over time
| |
− | Stop dimmer fade
| |
− | Start raising dimmer level
| |
− | Start lowering dimmer level
| |
− | Stop changing dimmer level
| |
− | Set color and level
| |
− | Toggle color and level
| |
− | Set color and level per mode
| |
− | Set color temperature and level
| |
− | Toggle color temperature and level
| |
− | Set color temperature and level per mode
| |
− | Change color temperature over time
| |
− | Stop changing color temperature
| |
− | Activate Scenes, Adjust Shades or Fans
| |
− | Activate scenes
| |
− | Activate scenes per mode
| |
− | Open shades
| |
− | Close shades
| |
− | Set shade position
| |
− | Set fan speed
| |
− | Cycle fans
| |
− | Control HSM, Garage Doors, Locks or Valves
| |
− | Arm/Disarm Hubitat® Safety Monitor
| |
− | Open garage door
| |
− | Close garage door
| |
− | Lock locks
| |
− | Unlock locks
| |
− | Open valves
| |
− | Close valves
| |
− | Control Thermostats or Thermostat Scheduler
| |
− | Set thermostats
| |
− | Set Thermostat Scheduler
| |
− | Send, Speak, or Log a Message, Send HTTP Request
| |
− | Send or Speak a Message
| |
− | Log a Message
| |
− | Send HTTP Get
| |
− | Send HTTP Post
| |
− | Control Music Player, Volume, Sounds
| |
− | Control Music Player
| |
− | Set Volume
| |
− | Mute
| |
− | Unmute
| |
− | Sound Tone
| |
− | Sound Chime
| |
− | Control Siren
| |
− | Set Mode or Variables, Run Custom Action
| |
− | Set Mode
| |
− | Run Custom Action
| |
− | Write to local file
| |
− | Append to local file
| |
− | Delete local file
| |
− | Set Private Boolean, Run/Cancel/Pause Rules
| |
− | Set Private Booleans True
| |
− | Set Private Booleans False
| |
− | Run Rule Actions
| |
− | Cancel Rule Timers
| |
− | Pause Rules
| |
− | Resume Rules
| |
− | Capture/Restore, Device Refresh or Polling
| |
− | Capture Devices
| |
− | Restore Devices
| |
− | Refresh devices
| |
− | Poll devices
| |
− | Start Z-Wave poll on switches
| |
− | Stop Z-Wave poll on switches
| |
− | Start Z-Wave poll on dimmers
| |
− | Stop Z-Wave poll on dimmers
| |
− | Delay or Repeat Actions, Wait
| |
− | Delay Actions
| |
− | Delay Actions Per Mode
| |
− | Cancel Delayed Actions
| |
− | Repeat Actions
| |
− | END-REP
| |
− | Stop Repeating Actions
| |
− | Wait for Events
| |
− | Wait for Condition
| |
− | Cancel Wait
| |
− | Exit Rule
| |
− | Comment</pre>
| |
− | | |
− | ===<big>Export, Import or Clone of Rule Machine Rules</big>===
| |
− | <big>Select this option to allow export of your Rule Machine rules for import to another hub, or to clone an existing rule as a base from which to start a new rule.</big>
| |
− | [[File:Export Import and Clone RM rule v2.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/9/99/Export_Import_and_Clone_RM_rule_v2.png
| |
− | ]]
| |
− | | |
− | ====<big>Export a Rule</big>====
| |
− | | |
− | #<big>Select a single or multiple rules for '''Export'''. You may export multiple rules to a single file, and still have the option to select which rules to later '''Import'''.</big>[[File:Export Selected RM rules v2.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/0/00/Export_Selected_RM_rules_v2.png ]]
| |
− | #<big>Press the '''Download''' button to save the file to your local drive in the designated file download location for your browser. Typically this will be your '''Downloads''' folder.</big>[[File:Export RM rule v2.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/5/52/Export_RM_rule_v2.png ]]
| |
− | | |
− | ====<big>Restore or Import a Rule</big>====
| |
− | <big>You may choose to '''Restore''' a rule instead of using the '''Import''' option. This is most appropriate for instances where you want to bring a Rule Machine rule into your hub database, but you do not want to change the name or the devices used in the rule. If you instead choose to '''Import''', the process will pause to allow the rule to be renamed, and the devices used in the rule to be substituted with other devices installed on your hub before completing the import process.</big>
| |
− | | |
− | '''<big>Restore</big>'''
| |
− | | |
− | #<big>To '''Restore''', select the saved file you previously exported, then press the '''Restore''' button.</big>[[File:Restore RM rule.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/6/6b/Restore_RM_rule.png ]]
| |
− | | |
− | '''<big>Import</big>'''
| |
− | | |
− | #<big>To '''Import''', select the saved file you previously exported and press the '''Import...''' button.</big>[[File:Import RM rule.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/c/c9/Import_RM_rule.png ]]
| |
− | #<big>Select the rules for import.</big>[[File:Selected RM rule for import.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/1/16/Selected_RM_rule_for_import.png ]]
| |
− | #<big>You will be prompted to replace the name and devices used in the rule if you need to.</big>
| |
− | #*<big>'''NOTE:''' If you '''Import''' a rule to another hub without selecting replacement devices, any existing devices with those same names will be used in the imported rule. If the devices do not exist, virtual devices with those same names will automatically be created. This is very helpful when you need to replace devices of an imported rule, but do not yet have the devices available that will replace them.</big>[[File:Rename and change RM devices before import.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/d/da/Rename_and_change_RM_devices_before_import.png ]]
| |
− | #<big>When ready to import, press the '''Import ['''rule name''']''' button.</big>[[File:Rule Machine Import.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/1/1a/Rule_Machine_Import.png ]]
| |
− | #<big>You will receive a confirmation that the rule you selected has been imported.</big>[[File:RM Import confirmation.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/9/9c/RM_Import_confirmation.png ]]
| |
− | #<big>If you changed the name, it will appear with the new name in your list of Rule Machine child apps.</big>[[File:Show imported Rule-5 rules.png|none|thumb|600x600px]]
| |
− | #*<big>'''<span style="color: red;;">IMPORTANT!</span>''' - If you import rules that contain a Private Boolean, it must be manually adjusted after importing the rule. In the following example, you will see that an imported rule will not keep the correct setting for Private Boolean after import, and therefore must be manually corrected.</big>[[File:Cloning or imported rules containing PB.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/0/0e/Cloning_or_imported_rules_containing_PB.png ]][[File:Imported rule with PB not pointing anywhere.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/d/d4/Imported_rule_with_PB_not_pointing_anywhere.png ]]
| |
− | | |
− | ====<big>Clone a Rule</big>====
| |
− | | |
− | #<big>To '''Clone''' a rule, select the rule from the list of available Rule Machine rules on your hub and press the '''Clone''' button.</big>[[File:Select Rule Machine rule for clone.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/2/2d/Select_Rule_Machine_rule_for_clone.png ]][[File:Initiate Rule Machine cloning.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/6/68/Initiate_Rule_Machine_cloning.png ]]
| |
− | #<big>You will be prompted to replace the name and devices used in the rule if you need to.</big>[[File:Rename and change RM devices before clone.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/d/dd/Rename_and_change_RM_devices_before_clone.png ]]
| |
− | #<big>When ready to proceed, press the '''Clone ['''rule name''']''' button.</big>[[File:Clone Rule Machine rule.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/5/55/Clone_Rule_Machine_rule.png ]]
| |
− | #<big>You will receive a confirmation that the rule you selected has been cloned.</big>[[File:RM rule clone confirmation.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/4/46/RM_rule_clone_confirmation.png ]]
| |
− | #<big>If you changed the name, it will appear with the new name in your list of Rule Machine child apps. If you did not change the name, the rule will be imported under the same name, but it will have the word '''clone''' added to the end.</big>[[File:Show cloned Rule-5 rule.png|none|thumb|600x600px]]
| |
− | #*<big><span style="color: red;;">'''IMPORTANT!'''</span> If you '''Clone''' rules that contain a Private Boolean, it must be manually corrected after cloning the rule. In the following example, you will see that a cloned rule will not keep the correct setting for Private Boolean after import, and therefore must be manually corrected.</big>[[File:Cloning or imported rules containing PB.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/0/0e/Cloning_or_imported_rules_containing_PB.png ]] [[File:Cloned rule with incorrect PB setting.png|none|thumb|600x600px|link=https://docs.hubitat.com/images/4/48/Cloned_rule_with_incorrect_PB_setting.png ]]
| |