Skip to content

Commit f7f939a

Browse files
committed
Add connection state to config
1 parent 8a68411 commit f7f939a

File tree

6 files changed

+56
-20
lines changed

6 files changed

+56
-20
lines changed

.devcontainer/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
version: '3'
1+
version: "3"
22

33
services:
44
iobroker:
55
build: ./iobroker
66
container_name: iobroker-gotify
77
hostname: iobroker-gotify
88
# This port is only internal, so we can work on this while another instance of ioBroker is running on the host
9-
expose:
10-
- 8081
9+
ports:
10+
- 8081:8081
1111
volumes:
1212
- ..:/workspace:cached
1313
- iobrokerdata-gotify:/opt/iobroker
@@ -34,4 +34,4 @@ services:
3434
- 8082:80
3535

3636
volumes:
37-
iobrokerdata-gotify:
37+
iobrokerdata-gotify:

build/main.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/main.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

io-package.json

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
{
22
"common": {
33
"name": "gotify",
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"news": {
6+
"0.2.1": {
7+
"en": "Optimized startup behavior when adapter is not configured",
8+
"de": "Optimiertes Startverhalten, wenn der Adapter nicht konfiguriert ist",
9+
"ru": "Оптимизировано поведение при запуске, когда адаптер не настроен.",
10+
"pt": "Comportamento de inicialização otimizado quando o adaptador não está configurado",
11+
"nl": "Geoptimaliseerd opstartgedrag wanneer de adapter niet is geconfigureerd",
12+
"fr": "Comportement de démarrage optimisé lorsque l'adaptateur n'est pas configuré",
13+
"it": "Comportamento di avvio ottimizzato quando l'adattatore non è configurato",
14+
"es": "Comportamiento de inicio optimizado cuando el adaptador no está configurado",
15+
"pl": "Zoptymalizowane zachowanie podczas uruchamiania, gdy adapter nie jest skonfigurowany",
16+
"uk": "Оптимізовано поведінку при запуску, коли адаптер не налаштовано",
17+
"zh-cn": "优化未配置适配器时的启动行为"
18+
},
619
"0.0.1": {
720
"en": "initial release",
821
"de": "Erstveröffentlichung",
@@ -69,31 +82,26 @@
6982
"uk": "Цей адаптер дозволяє надсилати повідомлення на поштовх, використовуючи",
7083
"zh-cn": "这种适应者使你能够向你发出动议的通知,以便你能够通过批准。"
7184
},
72-
"authors": [
73-
"Thomas Pohl <post@thomaspohl.net>"
74-
],
75-
"keywords": [
76-
"gotify",
77-
"notification",
78-
"communication"
79-
],
85+
"authors": ["Thomas Pohl <post@thomaspohl.net>"],
86+
"keywords": ["gotify", "notification", "communication"],
8087
"license": "Apache-2.0",
8188
"platform": "Javascript/Node.js",
8289
"main": "build/main.js",
8390
"icon": "gotify.png",
84-
"enabled": true,
8591
"extIcon": "https://raw.githubusercontent.com/ThomasPohl/ioBroker.gotify/master/admin/gotify.png",
8692
"readme": "https://github.com/ThomasPohl/ioBroker.gotify/blob/master/README.md",
8793
"loglevel": "info",
8894
"mode": "daemon",
8995
"type": "messaging",
9096
"compact": true,
9197
"connectionType": "cloud",
98+
"role": "indicator.connected",
9299
"dataSource": "push",
93100
"materialize": true,
94101
"blockly": true,
95102
"messagebox": true,
96103
"subscribe": "messagebox",
104+
"stopBeforeUpdate": true,
97105
"dependencies": [
98106
{
99107
"js-controller": ">=2.0.0"
@@ -105,5 +113,29 @@
105113
"token": ""
106114
},
107115
"objects": [],
108-
"instanceObjects": []
116+
"instanceObjects": [
117+
{
118+
"_id": "info.connection",
119+
"type": "state",
120+
"common": {
121+
"name": {
122+
"en": "Connected to Gotify server",
123+
"de": "Verbindung mit Gotify Server",
124+
"ru": "Подключен к серверу Gotify",
125+
"pt": "Conectado ao servidor Gotify",
126+
"nl": "Verbinding met Gotify server",
127+
"fr": "Connecté au serveur Gotify",
128+
"it": "Collegato al server Gotify",
129+
"es": "Conectado al servidor Gotify",
130+
"pl": "Łączy się z serwerem Gotify"
131+
},
132+
"type": "boolean",
133+
"role": "indicator.connected",
134+
"read": true,
135+
"write": false,
136+
"def": false
137+
},
138+
"native": {}
139+
}
140+
]
109141
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iobroker.gotify",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Send push notifications to gotify",
55
"author": {
66
"name": "Thomas Pohl",

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ class Gotify extends utils.Adapter {
3737
this.config.token = this.decrypt(this.config.token);
3838
}
3939
if (this.config.url && this.config.token) {
40+
this.setState("info.connection", true, true);
4041
this.log.info("Gotify adapter configured");
4142
} else {
42-
this.terminate("Gotify adapter not configured", utils.EXIT_CODES.INVALID_ADAPTER_CONFIG);
43+
this.setState("info.connection", false, true);
44+
this.log.warn("Gotify adapter not configured");
4345
}
4446
}
4547

0 commit comments

Comments
 (0)