Repository navigation
122 lines (116 loc) · 5.33 KB
/
Copy paththingsboard-push.yaml
File metadata and controls
122 lines (116 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
on:
push:
branches:
- main
- master
- dev
schedule:
# Daily at 07:00 UTC, two hours after pkgdown publishes the
# surface-water / groundwater ZIPs to the gh-pages branch.
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
station_ids:
description: 'Comma-separated Messstellennummer values to push (empty = auto)'
required: false
default: ''
history_days:
description: 'Push only the most recent N days per station (0 = all)'
required: false
default: '0'
telemetry_types:
description: 'Which telemetry to push: gwl,gwq | gwl | gwq'
required: false
default: 'gwl,gwq'
plan:
description: 'ThingsBoard plan: free | free-bulk | prototype | pilot | startup | business | ce'
required: false
default: 'free'
max_devices:
description: 'Max devices/stations to set up (0 = no limit; empty = default 5)'
required: false
default: ''
station_scope:
description: 'Auto-pick scope: both | any | gwl | gwq | gwl-only | gwq-only (empty = default both)'
required: false
default: ''
name: thingsboard-push
jobs:
push:
runs-on: ubuntu-latest
env:
# ----------------------------------------------------------------------
# Resolution chain for every TB_* variable below:
#
# workflow_dispatch input > repository secret > hardcoded default
#
# i.e. typing a value in the "Run workflow" dialog always wins;
# otherwise the optional repo secret (Settings > Secrets and
# variables > Actions) takes over; otherwise the literal default
# at the end of the line is used. This keeps cron runs configurable
# without editing this yaml.
#
# Required secrets (no default, the script aborts without them):
# TB_HOST e.g. https://eu.thingsboard.cloud or
# https://dashboards.inowas.org (self-hosted)
#
# Authentication -- set ONE of the following (username/password wins):
# TB_USERNAME + ThingsBoard login -> JWT Bearer token. Works on
# TB_PASSWORD every edition and is the ONLY option for
# self-hosted Community Edition (no account API
# keys there). For self-hosted also set TB_PLAN=ce.
# TB_API_KEY account-level API key, ThingsBoard Cloud only
# (X-Authorization: ApiKey)
#
# Optional secrets, all currently NOT set, all override the defaults
# below when added:
# TB_STATION_IDS comma-separated Messstellennummer (default:
# auto-pick top 5 by gwl+gwq score)
# TB_MAX_DEVICES max devices/stations to set up (default 5;
# 0 = no limit, push every candidate station)
# TB_STATION_SCOPE auto-pick pool: both (default) | any | gwl |
# gwq | gwl-only | gwq-only -- which groundwater
# stations qualify (gwl/gwq = has that series;
# *-only = excludes stations that have both)
# TB_HISTORY_DAYS "0" = full history since 1970, "30"/"365"
# for short windows
# TB_TELEMETRY_TYPES "gwl,gwq" | "gwl" | "gwq"
# TB_PLAN free | prototype | pilot | startup |
# business | ce -- selects mode, chunk_size
# and throttle via tb_plan_defaults()
# TB_TELEMETRY_MODE override the plan-derived mode
# TB_CHUNK_SIZE override the plan-derived chunk size
# TB_THROTTLE_SECONDS override the plan-derived inter-POST sleep
# TB_MAX_ACTIVE concurrent POSTs per device in single mode
# ----------------------------------------------------------------------
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
TB_HOST: ${{ secrets.TB_HOST }}
TB_API_KEY: ${{ secrets.TB_API_KEY }}
TB_USERNAME: ${{ secrets.TB_USERNAME }}
TB_PASSWORD: ${{ secrets.TB_PASSWORD }}
TB_STATION_IDS: ${{ github.event.inputs.station_ids || secrets.TB_STATION_IDS }}
TB_MAX_DEVICES: ${{ github.event.inputs.max_devices || secrets.TB_MAX_DEVICES }}
TB_STATION_SCOPE: ${{ github.event.inputs.station_scope || secrets.TB_STATION_SCOPE }}
TB_HISTORY_DAYS: ${{ github.event.inputs.history_days || secrets.TB_HISTORY_DAYS || '0' }}
TB_TELEMETRY_TYPES: ${{ github.event.inputs.telemetry_types || secrets.TB_TELEMETRY_TYPES || 'gwl,gwq' }}
TB_PLAN: ${{ github.event.inputs.plan || secrets.TB_PLAN || 'free' }}
TB_TELEMETRY_MODE: ${{ secrets.TB_TELEMETRY_MODE }}
TB_CHUNK_SIZE: ${{ secrets.TB_CHUNK_SIZE }}
TB_THROTTLE_SECONDS: ${{ secrets.TB_THROTTLE_SECONDS }}
TB_MAX_ACTIVE: ${{ secrets.TB_MAX_ACTIVE }}
steps:
- uses: actions/checkout@v5
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::httr2
any::jsonlite
any::sf
needs: check
- name: Install package
run: R CMD INSTALL .
- name: Push to ThingsBoard
run: Rscript inst/scripts/push_to_thingsboard.R