openhab-scripting 2.9.1 → 2.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/version.rb +1 -1
- metadata +1 -61
- data/.github/workflows/workflow.yml +0 -327
- data/.gitignore +0 -17
- data/.java-version +0 -1
- data/.rspec +0 -1
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -113
- data/Gemfile +0 -28
- data/Gemfile.lock +0 -245
- data/Guardfile +0 -35
- data/LICENSE +0 -277
- data/README.md +0 -23
- data/Rakefile +0 -406
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/config/userdata/config/org/openhab/restauth.config +0 -3
- data/cucumber.yml +0 -1
- data/docs/_config.yml +0 -135
- data/docs/contributing/index.md +0 -47
- data/docs/examples/conversions.md +0 -123
- data/docs/examples/index.md +0 -61
- data/docs/index.md +0 -19
- data/docs/installation/index.md +0 -26
- data/docs/motivation/index.md +0 -27
- data/docs/usage/execution.md +0 -9
- data/docs/usage/execution/delay.md +0 -48
- data/docs/usage/execution/otherwise.md +0 -30
- data/docs/usage/execution/run.md +0 -70
- data/docs/usage/execution/triggered.md +0 -48
- data/docs/usage/guards.md +0 -51
- data/docs/usage/guards/between.md +0 -30
- data/docs/usage/guards/not_if.md +0 -41
- data/docs/usage/guards/only_if.md +0 -40
- data/docs/usage/index.md +0 -11
- data/docs/usage/items.md +0 -66
- data/docs/usage/items/contact.md +0 -84
- data/docs/usage/items/dimmer.md +0 -147
- data/docs/usage/items/groups.md +0 -76
- data/docs/usage/items/number.md +0 -225
- data/docs/usage/items/string.md +0 -49
- data/docs/usage/items/switch.md +0 -85
- data/docs/usage/misc.md +0 -7
- data/docs/usage/misc/actions.md +0 -108
- data/docs/usage/misc/duration.md +0 -21
- data/docs/usage/misc/gems.md +0 -25
- data/docs/usage/misc/logging.md +0 -21
- data/docs/usage/misc/metadata.md +0 -128
- data/docs/usage/misc/store_states.md +0 -42
- data/docs/usage/misc/time_of_day.md +0 -69
- data/docs/usage/misc/timers.md +0 -67
- data/docs/usage/rule.md +0 -43
- data/docs/usage/things.md +0 -29
- data/docs/usage/triggers.md +0 -8
- data/docs/usage/triggers/changed.md +0 -57
- data/docs/usage/triggers/channel.md +0 -54
- data/docs/usage/triggers/command.md +0 -69
- data/docs/usage/triggers/cron.md +0 -19
- data/docs/usage/triggers/every.md +0 -76
- data/docs/usage/triggers/updated.md +0 -78
- data/openhab-scripting.gemspec +0 -30
- data/openhab_rules/warmup.rb +0 -5
data/docs/usage/triggers/cron.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: default
|
3
|
-
title: Cron
|
4
|
-
nav_order: 2
|
5
|
-
has_children: false
|
6
|
-
parent: Triggers
|
7
|
-
grand_parent: Usage
|
8
|
-
---
|
9
|
-
|
10
|
-
|
11
|
-
# Cron
|
12
|
-
Utilizes [OpenHAB style cron expressions](https://www.openhab.org/docs/configuration/rules-dsl.html#time-based-triggers) to trigger rules. This property can be utilized when you need to represent complex expressions not possible with the simpler [every](#Every) syntax.
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
rule 'Using Cron Syntax' do
|
16
|
-
cron '43 46 13 ? * ?'
|
17
|
-
run { logger.info "Cron rule executed" }
|
18
|
-
end
|
19
|
-
```
|
@@ -1,76 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: default
|
3
|
-
title: Every
|
4
|
-
nav_order: 1
|
5
|
-
has_children: false
|
6
|
-
parent: Triggers
|
7
|
-
grand_parent: Usage
|
8
|
-
---
|
9
|
-
|
10
|
-
# Every
|
11
|
-
|
12
|
-
| Value | Description | Example |
|
13
|
-
| ----------------- | ---------------------------------------- | ---------- |
|
14
|
-
| :second | Execute rule every second | :second |
|
15
|
-
| :minute | Execute rule very minute | :minute |
|
16
|
-
| :hour | Execute rule every hour | :hour |
|
17
|
-
| :day | Execute rule every day | :day |
|
18
|
-
| :week | Execute rule every week | :week |
|
19
|
-
| :month | Execute rule every month | :month |
|
20
|
-
| :year | Execute rule one a year | :year |
|
21
|
-
| :monday | Execute rule every Monday at midnight | :monday |
|
22
|
-
| :tuesday | Execute rule every Tuesday at midnight | :tuesday |
|
23
|
-
| :wednesday | Execute rule every Wednesday at midnight | :wednesday |
|
24
|
-
| :thursday | Execute rule every Thursday at midnight | :thursday |
|
25
|
-
| :friday | Execute rule every Friday at midnight | :friday |
|
26
|
-
| :saturday | Execute rule every Saturday at midnight | :saturday |
|
27
|
-
| :sunday | Execute rule every Sunday at midnight | :sunday |
|
28
|
-
| [Integer].seconds | Execute a rule every X seconds | 5.seconds |
|
29
|
-
| [Integer].minutes | Execute rule every X minutes | 3.minutes |
|
30
|
-
| [Integer].hours | Execute rule every X minutes | 10.hours |
|
31
|
-
|
32
|
-
| Option | Description | Example |
|
33
|
-
| ------ | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
|
34
|
-
| :at | Limit the execution to specific times of day. The value can either be a String or a TimeOfDay object | at: '16:45' or at: TimeOfDay.new(h: 16, m: 45) |
|
35
|
-
|
36
|
-
|
37
|
-
# Examples
|
38
|
-
|
39
|
-
```ruby
|
40
|
-
rule 'Log the rule name every minute' do
|
41
|
-
description 'This rule will create a log every minute'
|
42
|
-
every :minute
|
43
|
-
run { logger.info "Rule '#{name}' executed" }
|
44
|
-
end
|
45
|
-
```
|
46
|
-
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
rule 'Log an entry at 11:21' do
|
50
|
-
every :day, at: '11:21'
|
51
|
-
run { logger.info("Rule #{name} run at #{TimeOfDay.now}") }
|
52
|
-
end
|
53
|
-
|
54
|
-
# The above rule could also be expressed using TimeOfDay class as below
|
55
|
-
|
56
|
-
rule 'Log an entry at 11:21' do
|
57
|
-
every :day, at: TimeOfDay.new(h: 11, m: 21)
|
58
|
-
run { logger.info("Rule #{name} run at #{TimeOfDay.now}") }
|
59
|
-
end
|
60
|
-
```
|
61
|
-
|
62
|
-
|
63
|
-
```ruby
|
64
|
-
rule 'Log an entry Wednesdays at 11:21' do
|
65
|
-
every :wednesday, at: '11:21'
|
66
|
-
run { logger.info("Rule #{name} run at #{TimeOfDay.now}") }
|
67
|
-
end
|
68
|
-
```
|
69
|
-
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
rule 'Every 5 seconds' do
|
73
|
-
every 5.seconds
|
74
|
-
run { logger.info "Rule #{name} executed" }
|
75
|
-
end
|
76
|
-
```
|
@@ -1,78 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: default
|
3
|
-
title: Updated
|
4
|
-
nav_order: 4
|
5
|
-
has_children: false
|
6
|
-
parent: Triggers
|
7
|
-
grand_parent: Usage
|
8
|
-
---
|
9
|
-
|
10
|
-
# Updated
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
| Options | Description | Example |
|
15
|
-
| ------- | -------------------------------------------------- | ----------------------- |
|
16
|
-
| to | Only execute rule if update state matches to state | `to: 7` or `to: [7,14]` |
|
17
|
-
|
18
|
-
Changed accepts Items, Things or Groups.
|
19
|
-
|
20
|
-
The to value restricts the rule from running to only if the updated state matches. If the updated element being used as a trigger is a thing than the to and from values will accept symbols and strings, where the symbol matches the [supported status](https://www.openhab.org/docs/concepts/things.html).
|
21
|
-
|
22
|
-
The examples below assume the following background:
|
23
|
-
|
24
|
-
| type | name | group | state |
|
25
|
-
| ------ | ---------------- | ---------- | ----- |
|
26
|
-
| Number | Alarm_Mode | AlarmModes | 7 |
|
27
|
-
| Number | Alarm_Mode_Other | AlarmModes | 7 |
|
28
|
-
|
29
|
-
|
30
|
-
```ruby
|
31
|
-
rule 'Execute rule when item is updated to any value' do
|
32
|
-
updated Alarm_Mode
|
33
|
-
run { logger.info("Alarm Mode Updated") }
|
34
|
-
end
|
35
|
-
```
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
rule 'Execute rule when item is updated to specific number' do
|
39
|
-
updated Alarm_Mode, to: 7
|
40
|
-
run { logger.info("Alarm Mode Updated") }
|
41
|
-
end
|
42
|
-
```
|
43
|
-
|
44
|
-
```ruby
|
45
|
-
rule 'Execute rule when item is updated to one of many specific states' do
|
46
|
-
updated Alarm_Mode, to: [7,14]
|
47
|
-
run { logger.info("Alarm Mode Updated")}
|
48
|
-
end
|
49
|
-
```
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
rule 'Execute rule when group is updated to any state' do
|
53
|
-
updated AlarmModes
|
54
|
-
triggered { |item| logger.info("Group #{item.id} updated")}
|
55
|
-
end
|
56
|
-
```
|
57
|
-
|
58
|
-
```ruby
|
59
|
-
rule 'Execute rule when member of group is changed to any state' do
|
60
|
-
updated AlarmModes.items
|
61
|
-
triggered { |item| logger.info("Group item #{item.id} updated")}
|
62
|
-
end
|
63
|
-
```
|
64
|
-
|
65
|
-
```ruby
|
66
|
-
rule 'Execute rule when member of group is changed to one of many states' do
|
67
|
-
updated AlarmModes.items, to: [7,14]
|
68
|
-
triggered { |item| logger.info("Group item #{item.id} updated")}
|
69
|
-
end
|
70
|
-
```
|
71
|
-
|
72
|
-
Works with things as well:
|
73
|
-
```ruby
|
74
|
-
rule 'Execute rule when thing is updated' do
|
75
|
-
updated things['astro:sun:home'], :to => :uninitialized
|
76
|
-
run { |event| logger.info("Thing #{event.uid} status <trigger> to #{event.status}") }
|
77
|
-
end
|
78
|
-
```
|
data/openhab-scripting.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'lib/openhab/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'openhab-scripting'
|
7
|
-
spec.version = OpenHAB::VERSION
|
8
|
-
spec.authors = ["Brian O'Connell"]
|
9
|
-
spec.email = ['broconne@gmail.com']
|
10
|
-
|
11
|
-
spec.summary = 'JRuby Helper Libraries for OpenHAB Scripting'
|
12
|
-
spec.description = 'JRuby Helper Libraries for OpenHAB Scripting'
|
13
|
-
spec.homepage = 'https://boc-tothefuture.github.io/openhab-jruby/'
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
15
|
-
|
16
|
-
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
17
|
-
|
18
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata['source_code_uri'] = 'https://github.com/boc-tothefuture/openhab-jruby'
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/boc-tothefuture/openhab-jruby/blob/main/CHANGELOG.md'
|
21
|
-
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bundle)/}) }
|
26
|
-
end
|
27
|
-
spec.bindir = 'exe'
|
28
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
-
spec.require_paths = ['lib']
|
30
|
-
end
|