iobroker.mopeka 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -2
- package/admin/i18n/de.json +28 -0
- package/admin/i18n/en.json +28 -0
- package/admin/i18n/es.json +28 -0
- package/admin/i18n/fr.json +28 -0
- package/admin/i18n/it.json +28 -0
- package/admin/i18n/nl.json +28 -0
- package/admin/i18n/pl.json +28 -0
- package/admin/i18n/pt.json +28 -0
- package/admin/i18n/ru.json +28 -0
- package/admin/i18n/uk.json +28 -0
- package/admin/i18n/zh-cn.json +28 -0
- package/admin/jsonConfig.json +184 -0
- package/admin/mopeka.jpg +0 -0
- package/admin/mopeka.png +0 -0
- package/admin/webcomponents/mopeka-tank.js +173 -0
- package/admin/webcomponents/mopeka-tank.json +171 -0
- package/admin/webcomponents/mopeka-tank.svg +1 -0
- package/build/lib/DeviceManagement.d.ts +33 -0
- package/build/lib/DeviceManagement.js +355 -0
- package/build/lib/DeviceManagement.js.map +1 -0
- package/build/lib/ble-gateway-client.d.ts +145 -0
- package/build/lib/ble-gateway-client.js +493 -0
- package/build/lib/ble-gateway-client.js.map +1 -0
- package/build/lib/hci-info.d.ts +6 -0
- package/build/lib/hci-info.js +152 -0
- package/build/lib/hci-info.js.map +1 -0
- package/build/lib/i18n.d.ts +450 -0
- package/build/lib/i18n.js +454 -0
- package/build/lib/i18n.js.map +1 -0
- package/build/lib/mopeka.d.ts +27 -0
- package/build/lib/mopeka.js +91 -0
- package/build/lib/mopeka.js.map +1 -0
- package/build/lib/scanner.d.ts +40 -0
- package/build/lib/scanner.js +140 -0
- package/build/lib/scanner.js.map +1 -0
- package/build/lib/sensor-id.d.ts +7 -0
- package/build/lib/sensor-id.js +18 -0
- package/build/lib/sensor-id.js.map +1 -0
- package/build/lib/source.d.ts +57 -0
- package/build/lib/source.js +154 -0
- package/build/lib/source.js.map +1 -0
- package/build/main.d.ts +1 -0
- package/build/main.js +491 -0
- package/build/main.js.map +1 -0
- package/io-package.json +144 -0
- package/package.json +68 -4
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"i18n": true,
|
|
3
|
+
"type": "tabs",
|
|
4
|
+
"items": {
|
|
5
|
+
"_overview": {
|
|
6
|
+
"type": "panel",
|
|
7
|
+
"label": "Overview",
|
|
8
|
+
"items": {
|
|
9
|
+
"_tanks": {
|
|
10
|
+
"type": "custom",
|
|
11
|
+
"webComponent": "webcomponents/mopeka-tank.json",
|
|
12
|
+
"settings": {
|
|
13
|
+
"instance": "mopeka.${_instance}",
|
|
14
|
+
"showName": true,
|
|
15
|
+
"showDetails": true
|
|
16
|
+
},
|
|
17
|
+
"height": 300,
|
|
18
|
+
"help": "Shows the saved sensors. The same gas bottle is available as a widget in vis-2, devices and Aura.",
|
|
19
|
+
"xs": 12,
|
|
20
|
+
"sm": 12,
|
|
21
|
+
"md": 12,
|
|
22
|
+
"lg": 12,
|
|
23
|
+
"xl": 12
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"_deviceManager": {
|
|
28
|
+
"type": "panel",
|
|
29
|
+
"label": "Device manager",
|
|
30
|
+
"items": {
|
|
31
|
+
"_dm": {
|
|
32
|
+
"type": "deviceManager",
|
|
33
|
+
"xs": 12,
|
|
34
|
+
"sm": 12,
|
|
35
|
+
"md": 12,
|
|
36
|
+
"lg": 12,
|
|
37
|
+
"xl": 12,
|
|
38
|
+
"style": {
|
|
39
|
+
"width": "100%",
|
|
40
|
+
"height": "100%",
|
|
41
|
+
"overflow": "hidden"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"_main": {
|
|
47
|
+
"type": "panel",
|
|
48
|
+
"label": "Main settings",
|
|
49
|
+
"items": {
|
|
50
|
+
"source": {
|
|
51
|
+
"type": "select",
|
|
52
|
+
"xs": 12,
|
|
53
|
+
"sm": 6,
|
|
54
|
+
"md": 4,
|
|
55
|
+
"lg": 4,
|
|
56
|
+
"xl": 4,
|
|
57
|
+
"default": "direct",
|
|
58
|
+
"label": "BLE source",
|
|
59
|
+
"help": "Read sensors directly via an own Bluetooth controller, or through the central ble-gateway adapter.",
|
|
60
|
+
"options": [
|
|
61
|
+
{ "value": "direct", "label": "Direct (own controller)" },
|
|
62
|
+
{ "value": "gateway", "label": "Via ble-gateway" }
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"hciDevice": {
|
|
66
|
+
"newLine": true,
|
|
67
|
+
"type": "selectSendTo",
|
|
68
|
+
"command": "listHciAdapters",
|
|
69
|
+
"manual": true,
|
|
70
|
+
"hidden": "data.source !== 'direct'",
|
|
71
|
+
"xs": 12,
|
|
72
|
+
"sm": 6,
|
|
73
|
+
"md": 4,
|
|
74
|
+
"lg": 4,
|
|
75
|
+
"xl": 4,
|
|
76
|
+
"default": "",
|
|
77
|
+
"label": "Bluetooth adapter",
|
|
78
|
+
"help": "Selects the Bluetooth controller by MAC address (BD_ADDR). MAC is stable across reboots, hciX numbering is not."
|
|
79
|
+
},
|
|
80
|
+
"gatewayInstance": {
|
|
81
|
+
"newLine": true,
|
|
82
|
+
"type": "instance",
|
|
83
|
+
"adapter": "ble-gateway",
|
|
84
|
+
"hidden": "data.source !== 'gateway'",
|
|
85
|
+
"xs": 12,
|
|
86
|
+
"sm": 6,
|
|
87
|
+
"md": 4,
|
|
88
|
+
"lg": 4,
|
|
89
|
+
"xl": 4,
|
|
90
|
+
"default": "ble-gateway.0",
|
|
91
|
+
"label": "BLE gateway instance",
|
|
92
|
+
"help": "Which ble-gateway instance to subscribe to."
|
|
93
|
+
},
|
|
94
|
+
"scanDurationMs": {
|
|
95
|
+
"newLine": true,
|
|
96
|
+
"type": "number",
|
|
97
|
+
"min": 1000,
|
|
98
|
+
"max": 60000,
|
|
99
|
+
"step": 500,
|
|
100
|
+
"xs": 12,
|
|
101
|
+
"sm": 6,
|
|
102
|
+
"md": 3,
|
|
103
|
+
"lg": 3,
|
|
104
|
+
"xl": 3,
|
|
105
|
+
"default": 10000,
|
|
106
|
+
"label": "Scan duration (ms)",
|
|
107
|
+
"help": "How long the discovery scan should run."
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"_sensors": {
|
|
112
|
+
"type": "panel",
|
|
113
|
+
"label": "Sensors",
|
|
114
|
+
"items": {
|
|
115
|
+
"_scan": {
|
|
116
|
+
"type": "sendTo",
|
|
117
|
+
"command": "scan",
|
|
118
|
+
"jsonData": "{ \"duration\": ${data.scanDurationMs} }",
|
|
119
|
+
"useNative": true,
|
|
120
|
+
"variant": "contained",
|
|
121
|
+
"xs": 12,
|
|
122
|
+
"sm": 12,
|
|
123
|
+
"md": 4,
|
|
124
|
+
"lg": 4,
|
|
125
|
+
"xl": 4,
|
|
126
|
+
"label": "Scan for Mopeka sensors",
|
|
127
|
+
"help": "Runs a BLE discovery scan via the configured source and adds nearby Mopeka sensors to the table. Save the main settings first."
|
|
128
|
+
},
|
|
129
|
+
"sensors": {
|
|
130
|
+
"newLine": true,
|
|
131
|
+
"type": "table",
|
|
132
|
+
"label": "Configured sensors",
|
|
133
|
+
"xs": 12,
|
|
134
|
+
"sm": 12,
|
|
135
|
+
"md": 12,
|
|
136
|
+
"lg": 12,
|
|
137
|
+
"xl": 12,
|
|
138
|
+
"items": [
|
|
139
|
+
{
|
|
140
|
+
"title": "Enabled",
|
|
141
|
+
"attr": "enabled",
|
|
142
|
+
"type": "checkbox",
|
|
143
|
+
"default": true,
|
|
144
|
+
"width": 80
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"title": "Name",
|
|
148
|
+
"attr": "name",
|
|
149
|
+
"type": "text",
|
|
150
|
+
"default": "",
|
|
151
|
+
"filter": true
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"title": "MAC address",
|
|
155
|
+
"attr": "mac",
|
|
156
|
+
"type": "text",
|
|
157
|
+
"default": "",
|
|
158
|
+
"filter": true
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"title": "Tank medium",
|
|
162
|
+
"attr": "medium",
|
|
163
|
+
"type": "select",
|
|
164
|
+
"default": "propane",
|
|
165
|
+
"options": [
|
|
166
|
+
{ "value": "propane", "label": "Propane / LPG" },
|
|
167
|
+
{ "value": "air", "label": "Air / fuel / oil" },
|
|
168
|
+
{ "value": "water", "label": "Water" }
|
|
169
|
+
],
|
|
170
|
+
"width": 140
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"title": "Tank height (mm)",
|
|
174
|
+
"attr": "tankFullMm",
|
|
175
|
+
"type": "number",
|
|
176
|
+
"default": 0,
|
|
177
|
+
"width": 140
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
package/admin/mopeka.jpg
ADDED
|
Binary file
|
package/admin/mopeka.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
function e(e){return!!e.form}var t=[`header`,`staticText`,`divider`];function n(e,t){return e==null?``:typeof e==`object`?e[t]||e.en||Object.values(e).find(e=>!!e)||``:String(e)}function r(e){let n={};for(let[r,i]of Object.entries(e.items||{}))i&&!t.includes(i.type)&&(n[r]=i.type);return n}function i(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?e.toString():JSON.stringify(e)}function a(e,t){if(t!=null)switch(e){case`number`:case`slider`:{if(typeof t==`number`)return Number.isFinite(t)?t:void 0;let e=i(t).trim().replace(`,`,`.`);if(!e)return;let n=Number(e);return Number.isFinite(n)?n:void 0}case`checkbox`:return t===!0||t===`true`||t===1||t===`1`;default:return i(t)}}function o(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=a(i,t[r]);e!==void 0&&(n[r]=e)}return n}var s=`"Roboto", "Helvetica", "Arial", sans-serif`,c=Object.freeze({type:`light`,primary:`#3399CC`,primaryContrast:`#FFFFFF`,secondary:`#164477`,secondaryContrast:`#FFFFFF`,background:`#FFFFFF`,paper:`#FFFFFF`,text:`rgba(0, 0, 0, 0.87)`,textSecondary:`rgba(0, 0, 0, 0.6)`,divider:`rgba(0, 0, 0, 0.12)`,error:`#D32F2F`,warning:`#ED6C02`,info:`#0288D1`,success:`#2E7D32`,fontFamily:s,fontSize:14,borderRadius:4}),l=Object.freeze({type:`dark`,primary:`#4DABF5`,primaryContrast:`rgba(0, 0, 0, 0.87)`,secondary:`#436A93`,secondaryContrast:`#FFFFFF`,background:`#121212`,paper:`#121212`,text:`#FFFFFF`,textSecondary:`rgba(255, 255, 255, 0.7)`,divider:`rgba(255, 255, 255, 0.12)`,error:`#F44336`,warning:`#FFA726`,info:`#29B6F6`,success:`#66BB6A`,fontFamily:s,fontSize:14,borderRadius:4}),u=[`primary`,`primaryContrast`,`secondary`,`secondaryContrast`,`background`,`paper`,`text`,`textSecondary`,`divider`,`error`,`warning`,`info`,`success`,`fontFamily`],d=[`fontSize`,`borderRadius`];function f(e){return{...e===`dark`?l:c}}function p(e){if(!e||typeof e!=`object`)return f(typeof e==`string`?e:`light`);let t=e,n=f(typeof t.type==`string`?t.type:`light`);for(let e of u){let r=t[e];typeof r==`string`&&r.trim()&&(n[e]=r.trim())}for(let e of d){let r=t[e],i=typeof r==`string`?parseFloat(r):r;typeof i==`number`&&Number.isFinite(i)&&i>=0&&(n[e]=i)}return n}function m(e,t){return e.type===t.type&&u.every(n=>e[n]===t[n])&&d.every(n=>e[n]===t[n])}function h(e){return`--iob-${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function g(e){let t={};for(let n of u)t[h(n)]=e[n];for(let n of d)t[h(n)]=`${e[n]}px`;return t[`color-scheme`]=e.type,t}var _={ok:{en:`OK`,"zh-cn":`确定`},cancel:{en:`Cancel`,de:`Abbrechen`,ru:`Отмена`,pt:`Cancelar`,nl:`Annuleren`,fr:`Annuler`,it:`Annulla`,es:`Cancelar`,pl:`Anuluj`,uk:`Скасувати`,"zh-cn":`取消`},close:{en:`Close`,de:`Schließen`,ru:`Закрыть`,pt:`Fechar`,nl:`Sluiten`,fr:`Fermer`,it:`Chiudi`,es:`Cerrar`,pl:`Zamknij`,uk:`Закрити`,"zh-cn":`关闭`}},v=`
|
|
2
|
+
dialog {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
width: 480px;
|
|
5
|
+
max-width: calc(100vw - 32px);
|
|
6
|
+
max-height: calc(100vh - 32px);
|
|
7
|
+
padding: 0;
|
|
8
|
+
border: 0;
|
|
9
|
+
border-radius: calc(var(--iob-border-radius) * 2);
|
|
10
|
+
background: var(--iob-paper);
|
|
11
|
+
color: var(--iob-text);
|
|
12
|
+
font-family: var(--iob-font-family);
|
|
13
|
+
font-size: var(--iob-font-size);
|
|
14
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
15
|
+
}
|
|
16
|
+
/* as the dialogs of MUI: a dark paper gets lighter the higher it lies */
|
|
17
|
+
dialog.dark { background-image: linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)); }
|
|
18
|
+
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
|
|
19
|
+
dialog:focus { outline: none; }
|
|
20
|
+
form { display: flex; flex-direction: column; height: 100%; max-height: inherit; margin: 0; }
|
|
21
|
+
header { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 16px; font-size: 1.15em; font-weight: 500; }
|
|
22
|
+
header span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
23
|
+
.body { flex: 1; min-height: 0; padding: 0 16px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
|
|
24
|
+
footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
|
|
25
|
+
button { font: inherit; padding: 6px 16px; border-radius: var(--iob-border-radius); border: 1px solid var(--iob-primary); background: transparent; color: var(--iob-primary); cursor: pointer; }
|
|
26
|
+
button.primary { background: var(--iob-primary); color: var(--iob-primary-contrast); }
|
|
27
|
+
button.close { border: 0; padding: 2px 8px; font-size: 1.4em; line-height: 1; color: var(--iob-text-secondary); }
|
|
28
|
+
label { display: flex; flex-direction: column; gap: 4px; }
|
|
29
|
+
label.check { flex-direction: row; align-items: center; gap: 8px; }
|
|
30
|
+
input, select, textarea { font: inherit; accent-color: var(--iob-primary); }
|
|
31
|
+
.help { color: var(--iob-text-secondary); font-size: 0.85em; }
|
|
32
|
+
h3 { margin: 4px 0 0; font-size: 1em; }
|
|
33
|
+
p { margin: 0; }
|
|
34
|
+
hr { width: 100%; border: 0; border-top: 1px solid var(--iob-divider); margin: 0; }
|
|
35
|
+
[hidden] { display: none !important; }
|
|
36
|
+
`;function y(e){if(!e)return null;try{let t=Function(`data`,`return (${e});`);return e=>{try{return!!t(e)}catch{return!1}}}catch{return null}}function b(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function x(e){let{input:t,setting:n}=e;if(t)return t instanceof HTMLInputElement&&t.type===`checkbox`?t.checked:t instanceof HTMLSelectElement?n.options?.[t.selectedIndex]?.value:t.value}function S(e,t,r,i,a){let o={name:t,setting:r,box:e.createElement(`div`),hidden:y(r.hidden),disabled:y(r.disabled)},s=n(r.label,a);switch(r.type){case`header`:return o.box=e.createElement(`h3`),o.box.textContent=n(r.text,a)||s,o;case`staticText`:return o.box=e.createElement(`p`),o.box.textContent=n(r.text,a)||s,o;case`divider`:return o.box=e.createElement(`hr`),o}let c=e.createElement(`label`);o.box=c;let l=e.createElement(`span`);if(l.textContent=s||t,r.type===`checkbox`){let t=e.createElement(`input`);t.type=`checkbox`,t.checked=i===!0||i===`true`,c.className=`check`,c.append(t,l),o.input=t}else if(r.type===`select`){let t=e.createElement(`select`);for(let i of r.options||[]){let r=e.createElement(`option`);r.textContent=n(i.label,a),t.append(r)}let s=(r.options||[]).findIndex(e=>String(e.value)===b(i));t.selectedIndex=s===-1?0:s,c.append(l,t),o.input=t}else if(r.type===`text`&&(r.minRows||1)>1){let t=e.createElement(`textarea`);t.rows=r.minRows||2,t.value=b(i),c.append(l,t),o.input=t}else{let t=e.createElement(`input`),n=b(i);switch(r.type){case`number`:case`slider`:t.type=r.type===`slider`?`range`:`number`,r.min!==void 0&&(t.min=String(r.min)),r.max!==void 0&&(t.max=String(r.max)),t.step=r.step===void 0?`any`:String(r.step);break;case`password`:t.type=`password`;break;case`color`:t.type=!n||/^#[0-9a-f]{6}$/i.test(n)?`color`:`text`;break;default:t.type=`text`}if(t.value=n,t.type===`range`){let n=e.createElement(`output`);n.textContent=t.value,t.addEventListener(`input`,()=>n.textContent=t.value),l.append(`: `,n)}c.append(l,t),o.input=t}if(r.help){let t=e.createElement(`span`);t.className=`help`,t.textContent=n(r.help,a),c.append(t)}return o}function C(t,i={}){let a=i.lang||`en`,s=document,c=e=>_[e][a]||_[e].en||e,l=s.createElement(`div`);l.setAttribute(`data-iob-dialog`,``);let u=l.attachShadow({mode:`open`}),d=s.createElement(`style`);d.textContent=v;let f=s.createElement(`dialog`),m=p(i.theme);f.className=m.type===`dark`?`dark`:``;for(let[e,t]of Object.entries(g(m)))f.style.setProperty(e,t);t.width&&(f.style.width=`${t.width}px`),t.height&&(f.style.height=`${t.height}px`);let h=s.createElement(`form`),y=s.createElement(`header`),b=s.createElement(`span`);b.textContent=n(t.title,a);let C=s.createElement(`button`);C.type=`button`,C.className=`close`,C.title=c(`close`),C.setAttribute(`aria-label`,c(`close`)),C.textContent=`×`,y.append(b,C);let w=s.createElement(`div`);return w.className=`body`,h.append(y,w),f.append(h),u.append(d,f),new Promise(i=>{let d=!1,p=e=>{d||(d=!0,f.open&&f.close(),l.remove(),i(e))};if(C.addEventListener(`click`,()=>p(null)),f.addEventListener(`close`,()=>p(null)),h.addEventListener(`submit`,e=>e.preventDefault()),e(t)){let e={},i=[];for(let[e,n]of Object.entries(t.form.items||{})){let r=t.data?.[e]??n.default,o=S(s,e,n,r,a);i.push(o),w.append(o.box)}let l=()=>{for(let t of i)t.input&&(e[t.name]=x(t));return e},u=()=>{let e=l();for(let t of i)t.box.hidden=t.hidden?t.hidden(e):!1,t.input&&(t.input.disabled=t.disabled?t.disabled(e):!1)};h.addEventListener(`input`,u),h.addEventListener(`change`,u),u();let d=i.find(e=>e.input&&!e.box.hidden&&!e.input.disabled);d?.input&&(d.input.autofocus=!0);let f=s.createElement(`footer`),m=s.createElement(`button`);m.type=`button`,m.textContent=n(t.cancel,a)||c(`cancel`),m.addEventListener(`click`,()=>p(null));let g=s.createElement(`button`);g.type=`submit`,g.className=`primary`,g.textContent=n(t.ok,a)||c(`ok`),f.append(m,g),h.append(f),h.addEventListener(`submit`,()=>p(o(r(t.form),l())))}else w.append(t.element),f.addEventListener(`iob-dialog-close`,e=>p(e.detail??null));s.body.append(l),f.showModal(),u.activeElement&&u.activeElement!==C||(f.tabIndex=-1,f.focus())})}function w(e){return[...new Set(e.filter(e=>typeof e==`string`&&!!e))]}var T=[`socket`,`dialogs`,`theme`,`editMode`,`settings`,`value`],E=class extends HTMLElement{states={};objects={};#e=null;#t={};#n=p(`light`);#r=!1;#i=null;#a=void 0;#o=null;#s=!1;#c=(e,t)=>{this.#o?.states.includes(e)&&(this.states[e]=t||null,this.#_())};#l=(e,t)=>{this.#o?.objects.includes(e)&&(this.objects[e]=t||null,this.#d())};get socket(){return this.#e}set socket(e){this.#e=e||null,this.#d()}get settings(){return this.#t}set settings(e){this.#t=e||{},this.#d()}get theme(){return this.#n}set theme(e){let t=p(e);m(t,this.#n)||(this.#n=t,this.#u(),this.#_())}get editMode(){return this.#r}set editMode(e){let t=!!e;t!==this.#r&&(this.#r=t,this.#_())}get dialogs(){return this.#i}set dialogs(e){this.#i=e||null}get value(){return this.#a}set value(e){e!==this.#a&&(this.#a=e,this.#_())}connectedCallback(){for(let e of T)if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}this.#u(),this.#d()}disconnectedCallback(){this.#g()}getStateIds(e){return[]}getObjectIds(e){return[]}get systemLang(){return this.#e?.systemLang||`en`}text(e){return n(e,this.systemLang)}setState(e,t){return this.#e&&!this.#r?this.#e.setState(e,t):Promise.resolve()}changeValue(e){return this.#r||this.emit(`iob-change`,e)?!1:(this.value=e,!0)}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}async openDialog(t){if(this.#r)return null;let n=this.#i?await this.#i.open(t):await C(t,{lang:this.systemLang,theme:this.#n});return e(t)?n&&typeof n==`object`?o(r(t.form),n):null:n??null}#u(){for(let[e,t]of Object.entries(g(this.#n)))this.style.setProperty(e,t)}#d(){if(!this.isConnected)return;let e=this.#e,t=e?w(this.getStateIds(this.#t)):[],n=e?w(this.getObjectIds(this.#t)):[];this.#o&&this.#o.socket!==e&&this.#g();let r=this.#o?.states||[],i=this.#o?.objects||[],a=r.filter(e=>!t.includes(e)),o=i.filter(e=>!n.includes(e)),s=t.filter(e=>!r.includes(e)),c=n.filter(e=>!i.includes(e));e&&a.length&&e.unsubscribeState(a,this.#c),e&&o.length&&this.#h(e,o);for(let e of a)delete this.states[e];for(let e of[...a,...o])!t.includes(e)&&!n.includes(e)&&delete this.objects[e];this.#o=e&&(t.length||n.length)?{socket:e,states:t,objects:n}:null,e&&s.length&&this.#p(e,s),e&&c.length&&this.#m(e,c),this.#_()}#f(e,t,n){return this.#o?.socket===e&&this.#o[t].includes(n)}#p(e,t){e.subscribeState(t,this.#c).catch(e=>console.warn(`<${this.localName}>: cannot subscribe ${t.join(`, `)}: ${e}`));for(let n of t)e.getState(n).then(t=>{this.#f(e,`states`,n)&&this.states[n]===void 0&&(this.states[n]=t||null,this.#_())}).catch(()=>{}),e.getObject(n).then(t=>{this.#f(e,`states`,n)&&!this.#f(e,`objects`,n)&&(this.objects[n]=t||null,this.#_())}).catch(()=>{})}#m(e,t){e.subscribeObject(t,this.#l).catch(e=>console.warn(`<${this.localName}>: cannot subscribe the objects ${t.join(`, `)}: ${e}`));for(let n of t)e.getObject(n).then(t=>{this.#f(e,`objects`,n)&&(this.objects[n]=t||null,this.#d())}).catch(()=>{})}#h(e,t){e.unsubscribeObject(t,this.#l).catch(()=>{})}#g(){if(this.#o){let{socket:e,states:t,objects:n}=this.#o;t.length&&e.unsubscribeState(t,this.#c),n.length&&this.#h(e,n),this.#o=null}this.states={},this.objects={}}#_(){this.#s||(this.#s=!0,queueMicrotask(()=>{this.#s=!1,this.isConnected&&this.render()}))}};function D(e,t){let n=typeof e==`string`?e:e.tag;customElements.get(n)||customElements.define(n,t)}function O(e){return(e||``).toString().replace(/[^a-zA-Z0-9_]/g,`_`)}function k(e){return e.toLowerCase().replace(/[^a-f0-9]/g,``)}function A(e){return`sensors.${(e.name?O(e.name):``)||`s_${k(e.mac)}`}`}var j=`0 0 100 184`,M=170,N=`M14 64C14 44 30 36 50 36S86 44 86 64V154C86 166 72 170 50 170S14 166 14 154Z`,P=`M34 6h32a6 6 0 0 1 6 6v26H28V12a6 6 0 0 1 6-6Zm4 6a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h24a3 3 0 0 0 3-3v-4a3 3 0 0 0-3-3Z`;function F(e){return e.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`)}function I(e){let t=134*(e.fill===null||!Number.isFinite(e.fill)?0:Math.max(0,Math.min(100,e.fill)))/100,n=M-t,r=`mopeka-body-${e.uid}`,i=`mopeka-shine-${e.uid}`,a=e.sublabel?106:112,o=[`<svg class="bottle" viewBox="${j}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="${F([e.label,e.sublabel].filter(Boolean).join(` `))}">`,`<defs>`,`<clipPath id="${r}"><path d="${N}"/></clipPath>`,`<linearGradient id="${i}" x1="0" x2="1" y1="0" y2="0">`,`<stop offset="0" stop-color="#fff" stop-opacity=".04"/>`,`<stop offset=".22" stop-color="#fff" stop-opacity=".32"/>`,`<stop offset=".46" stop-color="#fff" stop-opacity="0"/>`,`<stop offset="1" stop-color="#000" stop-opacity=".16"/>`,`</linearGradient>`,`</defs>`,`<g class="art">`,`<rect class="metal" x="24" y="158" width="52" height="24" rx="3"/>`,`<path class="metal" fill-rule="evenodd" d="${P}"/>`,`<path class="body" d="${N}"/>`,`<g clip-path="url(#${r})">`];if(t>0&&o.push(`<rect class="liquid ${e.level}" x="0" y="${n.toFixed(2)}" width="100" height="${t.toFixed(2)}"/>`,`<rect class="surface ${e.level}" x="0" y="${n.toFixed(2)}" width="100" height="2.5"/>`),o.push(`<rect x="0" y="0" width="100" height="184" fill="url(#${i})"/>`,`</g>`,`<path class="seam" d="M14.5 104H85.5"/>`,`<path class="outline" d="${N}"/>`,`<rect class="valve" x="44" y="24" width="12" height="14" rx="2"/>`,`</g>`,`<text class="label" x="50" y="${a}" text-anchor="middle">${F(e.label)}</text>`),e.sublabel){let t=e.alert?`sublabel alert`:`sublabel`;o.push(`<text class="${t}" x="50" y="126" text-anchor="middle">${F(e.sublabel)}</text>`)}return o.push(`</svg>`),o.join(``)}var L=`iob-mopeka-tank`,R=[`level_pct`,`level_mm`,`temperature`,`battery_pct`,`quality`,`reachable`],z={chooseSensor:`Choose a sensor or an instance in the settings`,noSensors:`No sensors configured`,offline:`offline`,noHeight:`Set the tank height in the adapter to see the fill level in %`,temperature:`Temperature`,battery:`Battery`,quality:`Reading quality`},B={en:z,de:{chooseSensor:`Sensor oder Instanz in den Einstellungen wählen`,noSensors:`Keine Sensoren konfiguriert`,offline:`offline`,noHeight:`Tankhöhe im Adapter eintragen, um den Füllstand in % zu sehen`,temperature:`Temperatur`,battery:`Batterie`,quality:`Messqualität`},ru:{chooseSensor:`Выберите датчик или экземпляр в настройках`,noSensors:`Датчики не настроены`,offline:`нет связи`,noHeight:`Укажите высоту бака в адаптере, чтобы видеть уровень в %`,temperature:`Температура`,battery:`Батарея`,quality:`Качество измерения`},pt:{chooseSensor:`Escolha um sensor ou uma instância nas definições`,noSensors:`Nenhum sensor configurado`,offline:`offline`,noHeight:`Defina a altura do tanque no adaptador para ver o nível em %`,temperature:`Temperatura`,battery:`Bateria`,quality:`Qualidade da leitura`},nl:{chooseSensor:`Kies een sensor of een instantie in de instellingen`,noSensors:`Geen sensoren geconfigureerd`,offline:`offline`,noHeight:`Stel de tankhoogte in de adapter in om het vulniveau in % te zien`,temperature:`Temperatuur`,battery:`Batterij`,quality:`Meetkwaliteit`},fr:{chooseSensor:`Choisissez un capteur ou une instance dans les paramètres`,noSensors:`Aucun capteur configuré`,offline:`hors ligne`,noHeight:`Indiquez la hauteur du réservoir dans l'adaptateur pour voir le niveau en %`,temperature:`Température`,battery:`Batterie`,quality:`Qualité de mesure`},it:{chooseSensor:`Scegli un sensore o un'istanza nelle impostazioni`,noSensors:`Nessun sensore configurato`,offline:`offline`,noHeight:`Imposta l'altezza del serbatoio nell'adattatore per vedere il livello in %`,temperature:`Temperatura`,battery:`Batteria`,quality:`Qualità della lettura`},es:{chooseSensor:`Elija un sensor o una instancia en los ajustes`,noSensors:`No hay sensores configurados`,offline:`sin conexión`,noHeight:`Indique la altura del depósito en el adaptador para ver el nivel en %`,temperature:`Temperatura`,battery:`Batería`,quality:`Calidad de lectura`},pl:{chooseSensor:`Wybierz czujnik lub instancję w ustawieniach`,noSensors:`Brak skonfigurowanych czujników`,offline:`offline`,noHeight:`Ustaw wysokość zbiornika w adapterze, aby zobaczyć poziom w %`,temperature:`Temperatura`,battery:`Bateria`,quality:`Jakość pomiaru`},uk:{chooseSensor:`Виберіть датчик або екземпляр у налаштуваннях`,noSensors:`Датчики не налаштовано`,offline:`немає зв'язку`,noHeight:`Вкажіть висоту бака в адаптері, щоб бачити рівень у %`,temperature:`Температура`,battery:`Батарея`,quality:`Якість вимірювання`},"zh-cn":{chooseSensor:`请在设置中选择传感器或实例`,noSensors:`未配置传感器`,offline:`离线`,noHeight:`在适配器中设置罐高度以查看百分比液位`,temperature:`温度`,battery:`电池`,quality:`读数质量`}};function V(e,t){return(B[t]||z)[e]}var H=`
|
|
37
|
+
:host {
|
|
38
|
+
display: block;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
container-type: size;
|
|
42
|
+
}
|
|
43
|
+
.root {
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: stretch;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
gap: 4cqmin;
|
|
51
|
+
padding: 2cqmin;
|
|
52
|
+
}
|
|
53
|
+
.tank {
|
|
54
|
+
flex: 1 1 0;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
max-width: calc(100cqh * 0.8);
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 1.5cqmin;
|
|
61
|
+
}
|
|
62
|
+
.bottle {
|
|
63
|
+
/* only the height left over by the name and the details */
|
|
64
|
+
flex: 1 1 0;
|
|
65
|
+
min-height: 0;
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
.offline .art {
|
|
69
|
+
opacity: 0.45;
|
|
70
|
+
}
|
|
71
|
+
.name {
|
|
72
|
+
max-width: 100%;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
font-size: clamp(11px, 7cqmin, 20px);
|
|
78
|
+
}
|
|
79
|
+
.details {
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-wrap: wrap;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
column-gap: 0.8em;
|
|
84
|
+
font-size: clamp(10px, 5.5cqmin, 15px);
|
|
85
|
+
color: var(--iob-text-secondary);
|
|
86
|
+
white-space: nowrap;
|
|
87
|
+
}
|
|
88
|
+
.details span {
|
|
89
|
+
display: inline-flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
gap: 0.25em;
|
|
92
|
+
}
|
|
93
|
+
.details svg {
|
|
94
|
+
height: 1.05em;
|
|
95
|
+
width: auto;
|
|
96
|
+
fill: currentColor;
|
|
97
|
+
}
|
|
98
|
+
.details .weak {
|
|
99
|
+
color: var(--iob-error);
|
|
100
|
+
}
|
|
101
|
+
.bar {
|
|
102
|
+
opacity: 0.3;
|
|
103
|
+
}
|
|
104
|
+
.bar.on {
|
|
105
|
+
opacity: 1;
|
|
106
|
+
}
|
|
107
|
+
.message {
|
|
108
|
+
margin: auto;
|
|
109
|
+
padding: 4cqmin;
|
|
110
|
+
text-align: center;
|
|
111
|
+
color: var(--iob-text-secondary);
|
|
112
|
+
font-size: clamp(11px, 6cqmin, 16px);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* the bottle, see bottle.ts */
|
|
116
|
+
.metal {
|
|
117
|
+
fill: color-mix(in srgb, var(--iob-text-secondary) 45%, var(--iob-paper));
|
|
118
|
+
stroke: var(--iob-text-secondary);
|
|
119
|
+
stroke-width: 2;
|
|
120
|
+
}
|
|
121
|
+
.body {
|
|
122
|
+
fill: color-mix(in srgb, var(--iob-text) 8%, var(--iob-paper));
|
|
123
|
+
}
|
|
124
|
+
.outline {
|
|
125
|
+
fill: none;
|
|
126
|
+
stroke: var(--iob-text-secondary);
|
|
127
|
+
stroke-width: 2.5;
|
|
128
|
+
}
|
|
129
|
+
.seam {
|
|
130
|
+
stroke: var(--iob-text-secondary);
|
|
131
|
+
stroke-opacity: 0.35;
|
|
132
|
+
stroke-width: 1.5;
|
|
133
|
+
}
|
|
134
|
+
.valve {
|
|
135
|
+
fill: var(--iob-text-secondary);
|
|
136
|
+
}
|
|
137
|
+
.liquid.ok {
|
|
138
|
+
fill: var(--iob-success);
|
|
139
|
+
}
|
|
140
|
+
.liquid.low {
|
|
141
|
+
fill: var(--iob-warning);
|
|
142
|
+
}
|
|
143
|
+
.liquid.critical {
|
|
144
|
+
fill: var(--iob-error);
|
|
145
|
+
}
|
|
146
|
+
.liquid.unknown {
|
|
147
|
+
fill: var(--iob-text-secondary);
|
|
148
|
+
}
|
|
149
|
+
.surface {
|
|
150
|
+
fill: #fff;
|
|
151
|
+
fill-opacity: 0.35;
|
|
152
|
+
}
|
|
153
|
+
.label,
|
|
154
|
+
.sublabel {
|
|
155
|
+
fill: var(--iob-text);
|
|
156
|
+
stroke: var(--iob-paper);
|
|
157
|
+
paint-order: stroke;
|
|
158
|
+
stroke-linejoin: round;
|
|
159
|
+
}
|
|
160
|
+
.label {
|
|
161
|
+
font-size: 20px;
|
|
162
|
+
font-weight: 700;
|
|
163
|
+
stroke-width: 4px;
|
|
164
|
+
}
|
|
165
|
+
.sublabel {
|
|
166
|
+
font-size: 11px;
|
|
167
|
+
stroke-width: 3px;
|
|
168
|
+
}
|
|
169
|
+
.sublabel.alert {
|
|
170
|
+
fill: var(--iob-error);
|
|
171
|
+
font-weight: 700;
|
|
172
|
+
}
|
|
173
|
+
`,U=`system.adapter.`,W=20,G={sensor:{id:`sample`,name:`Propane`},values:{level_pct:65,level_mm:198,temperature:12.5,battery_pct:90,quality:3,reachable:!0}};function K(e){let t=(e||``).trim();return t.startsWith(U)?t.slice(15):t}function q(e){let t=e.trim().split(`.`);return t[2]===`sensors`&&t.length>4?t.slice(0,4).join(`.`):t.join(`.`)}function J(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:parseFloat(String(e));return Number.isFinite(t)?t:null}var Y=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 13.2V5a3 3 0 0 0-6 0v8.2a5 5 0 1 0 6 0ZM12 4a1 1 0 0 1 1 1v5h-2V5a1 1 0 0 1 1-1Z"/></svg>`;function X(e){return`<svg viewBox="0 0 26 14" aria-hidden="true"><rect x="1" y="1" width="21" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="22.6" y="4.5" width="2.4" height="5" rx="1"/><rect x="3" y="3" width="${(17*Math.max(0,Math.min(100,e))/100).toFixed(1)}" height="8" rx="1"/></svg>`}function Z(e){return`<svg viewBox="0 0 16 14" aria-hidden="true">${[5,9,13].map((t,n)=>`<rect class="bar${n<e?` on`:``}" x="${1+n*5}" y="${14-t}" width="4" height="${t}" rx="1"/>`).join(``)}</svg>`}D(L,class extends E{#e;constructor(){super(),this.#e=this.attachShadow({mode:`open`})}getObjectIds(e){if(e.sensor)return[q(e.sensor)];let t=K(e.instance);return t?[`${U}${t}`]:[]}getStateIds(e){return(this.#t(e)||[]).flatMap(e=>R.map(t=>`${e.id}.${t}`))}#t(e){if(e.sensor){let t=q(e.sensor);return[{id:t,name:this.text(this.objects[t]?.common?.name)||t.split(`.`).pop()||t}]}let t=K(e.instance);if(!t)return null;let n=this.objects[`${U}${t}`]?.native;return(Array.isArray(n?.sensors)?n.sensors:[]).filter(e=>e?.mac&&e.enabled!==!1).map(e=>({id:`${t}.${A(e)}`,name:e.name||e.mac}))}#n(e,t){let n=this.systemLang===`zh-cn`?`zh-CN`:this.systemLang;try{return e.toLocaleString(n,{minimumFractionDigits:t,maximumFractionDigits:t})}catch{return e.toFixed(t)}}#r(e,t,n){let r=this.settings,i=this.systemLang,a=J(t.level_pct),o=J(t.level_mm),s=J(t.temperature),c=J(t.battery_pct),l=J(t.quality),u=t.reachable===!1,d=typeof r.lowPct==`number`?r.lowPct:W,f=`unknown`;a!==null&&(f=a<=d/2?`critical`:a<=d?`low`:`ok`);let p=`–`;a===null?o!==null&&(p=`${this.#n(o,0)} mm`):p=`${this.#n(a,0)} %`;let m=a!==null&&o!==null?`${this.#n(o,0)} mm`:void 0;u&&(m=V(`offline`,i));let h=a===null&&o!==null?V(`noHeight`,i):``,g=`<div class="tank${u?` offline`:``}"${h?` title="${F(h)}"`:``}>`;if(g+=I({fill:a,level:f,label:p,sublabel:m,alert:u,uid:String(n)}),r.showName!==!1&&(g+=`<div class="name" title="${F(e.name)}">${F(e.name)}</div>`),r.showDetails!==!1){let e=[];s!==null&&e.push(`<span title="${F(V(`temperature`,i))}">${Y}${this.#n(s,1)} °C</span>`),c!==null&&e.push(`<span class="${c<20?`weak`:``}" title="${F(V(`battery`,i))}">${X(c)}${this.#n(c,0)} %</span>`),l!==null&&e.push(`<span title="${F(V(`quality`,i))}">${Z(l)}</span>`),e.length&&(g+=`<div class="details">${e.join(``)}</div>`)}return`${g}</div>`}#i(){let e=this.settings,t=this.systemLang,n=this.#t(e);return n?n.length?n.map((e,t)=>{let n={};for(let t of R)n[t]=this.states[`${e.id}.${t}`]?.val;return this.#r(e,n,t)}).join(``):this.objects[`${U}${K(e.instance)}`]===void 0?``:`<div class="message">${F(V(`noSensors`,t))}</div>`:this.editMode?this.#r(G.sensor,G.values,0):`<div class="message">${F(V(`chooseSensor`,t))}</div>`}render(){this.#e.innerHTML=`<style>${H}</style><div class="root">${this.#i()}</div>`}});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/ioBroker/web-components/main/schemas/manifest.json",
|
|
3
|
+
"manifestVersion": 1,
|
|
4
|
+
"tag": "iob-mopeka-tank",
|
|
5
|
+
"name": {
|
|
6
|
+
"en": "Mopeka gas bottle",
|
|
7
|
+
"de": "Mopeka Gasflasche",
|
|
8
|
+
"ru": "Газовый баллон Mopeka",
|
|
9
|
+
"pt": "Botija de gás Mopeka",
|
|
10
|
+
"nl": "Mopeka gasfles",
|
|
11
|
+
"fr": "Bouteille de gaz Mopeka",
|
|
12
|
+
"it": "Bombola del gas Mopeka",
|
|
13
|
+
"es": "Bombona de gas Mopeka",
|
|
14
|
+
"pl": "Butla gazowa Mopeka",
|
|
15
|
+
"uk": "Газовий балон Mopeka",
|
|
16
|
+
"zh-cn": "Mopeka 煤气罐"
|
|
17
|
+
},
|
|
18
|
+
"description": {
|
|
19
|
+
"en": "Fill level of Mopeka tank sensors as a gas bottle, with temperature, battery and reading quality",
|
|
20
|
+
"de": "Füllstand von Mopeka-Tanksensoren als Gasflasche, mit Temperatur, Batterie und Messqualität",
|
|
21
|
+
"ru": "Уровень заполнения датчиков Mopeka в виде газового баллона, с температурой, батареей и качеством измерения",
|
|
22
|
+
"pt": "Nível dos sensores de tanque Mopeka como botija de gás, com temperatura, bateria e qualidade da leitura",
|
|
23
|
+
"nl": "Vulniveau van Mopeka-tanksensoren als gasfles, met temperatuur, batterij en meetkwaliteit",
|
|
24
|
+
"fr": "Niveau des capteurs de réservoir Mopeka sous forme de bouteille de gaz, avec température, batterie et qualité de mesure",
|
|
25
|
+
"it": "Livello dei sensori Mopeka come bombola del gas, con temperatura, batteria e qualità della lettura",
|
|
26
|
+
"es": "Nivel de los sensores de depósito Mopeka como bombona de gas, con temperatura, batería y calidad de lectura",
|
|
27
|
+
"pl": "Poziom czujników zbiornika Mopeka jako butla gazowa, z temperaturą, baterią i jakością pomiaru",
|
|
28
|
+
"uk": "Рівень датчиків Mopeka у вигляді газового балона, з температурою, батареєю та якістю вимірювання",
|
|
29
|
+
"zh-cn": "以煤气罐显示 Mopeka 液位传感器的液位,以及温度、电池和读数质量"
|
|
30
|
+
},
|
|
31
|
+
"icon": "mopeka-tank.svg",
|
|
32
|
+
"module": "mopeka-tank.js",
|
|
33
|
+
"size": {
|
|
34
|
+
"width": 160,
|
|
35
|
+
"height": 260
|
|
36
|
+
},
|
|
37
|
+
"settings": {
|
|
38
|
+
"type": "panel",
|
|
39
|
+
"items": {
|
|
40
|
+
"sensor": {
|
|
41
|
+
"type": "objectId",
|
|
42
|
+
"types": "device",
|
|
43
|
+
"root": "mopeka",
|
|
44
|
+
"label": {
|
|
45
|
+
"en": "Sensor",
|
|
46
|
+
"de": "Sensor",
|
|
47
|
+
"ru": "Датчик",
|
|
48
|
+
"pt": "Sensor",
|
|
49
|
+
"nl": "Sensor",
|
|
50
|
+
"fr": "Capteur",
|
|
51
|
+
"it": "Sensore",
|
|
52
|
+
"es": "Sensor",
|
|
53
|
+
"pl": "Czujnik",
|
|
54
|
+
"uk": "Датчик",
|
|
55
|
+
"zh-cn": "传感器"
|
|
56
|
+
},
|
|
57
|
+
"help": {
|
|
58
|
+
"en": "A sensor below mopeka.X.sensors. Empty: all sensors of the instance",
|
|
59
|
+
"de": "Ein Sensor unter mopeka.X.sensors. Leer: alle Sensoren der Instanz",
|
|
60
|
+
"ru": "Датчик в mopeka.X.sensors. Пусто: все датчики экземпляра",
|
|
61
|
+
"pt": "Um sensor em mopeka.X.sensors. Vazio: todos os sensores da instância",
|
|
62
|
+
"nl": "Een sensor onder mopeka.X.sensors. Leeg: alle sensoren van de instantie",
|
|
63
|
+
"fr": "Un capteur sous mopeka.X.sensors. Vide : tous les capteurs de l'instance",
|
|
64
|
+
"it": "Un sensore sotto mopeka.X.sensors. Vuoto: tutti i sensori dell'istanza",
|
|
65
|
+
"es": "Un sensor bajo mopeka.X.sensors. Vacío: todos los sensores de la instancia",
|
|
66
|
+
"pl": "Czujnik w mopeka.X.sensors. Puste: wszystkie czujniki instancji",
|
|
67
|
+
"uk": "Датчик у mopeka.X.sensors. Порожньо: усі датчики екземпляра",
|
|
68
|
+
"zh-cn": "mopeka.X.sensors 下的传感器。留空:该实例的所有传感器"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"instance": {
|
|
72
|
+
"type": "instance",
|
|
73
|
+
"adapter": "mopeka",
|
|
74
|
+
"default": "mopeka.0",
|
|
75
|
+
"hidden": "!!data.sensor",
|
|
76
|
+
"label": {
|
|
77
|
+
"en": "Instance",
|
|
78
|
+
"de": "Instanz",
|
|
79
|
+
"ru": "Экземпляр",
|
|
80
|
+
"pt": "Instância",
|
|
81
|
+
"nl": "Instantie",
|
|
82
|
+
"fr": "Instance",
|
|
83
|
+
"it": "Istanza",
|
|
84
|
+
"es": "Instancia",
|
|
85
|
+
"pl": "Instancja",
|
|
86
|
+
"uk": "Екземпляр",
|
|
87
|
+
"zh-cn": "实例"
|
|
88
|
+
},
|
|
89
|
+
"help": {
|
|
90
|
+
"en": "Shows all configured sensors of this instance",
|
|
91
|
+
"de": "Zeigt alle konfigurierten Sensoren dieser Instanz",
|
|
92
|
+
"ru": "Показывает все настроенные датчики этого экземпляра",
|
|
93
|
+
"pt": "Mostra todos os sensores configurados desta instância",
|
|
94
|
+
"nl": "Toont alle geconfigureerde sensoren van deze instantie",
|
|
95
|
+
"fr": "Affiche tous les capteurs configurés de cette instance",
|
|
96
|
+
"it": "Mostra tutti i sensori configurati di questa istanza",
|
|
97
|
+
"es": "Muestra todos los sensores configurados de esta instancia",
|
|
98
|
+
"pl": "Pokazuje wszystkie skonfigurowane czujniki tej instancji",
|
|
99
|
+
"uk": "Показує всі налаштовані датчики цього екземпляра",
|
|
100
|
+
"zh-cn": "显示该实例的所有已配置传感器"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"showName": {
|
|
104
|
+
"type": "checkbox",
|
|
105
|
+
"default": true,
|
|
106
|
+
"label": {
|
|
107
|
+
"en": "Show name",
|
|
108
|
+
"de": "Namen anzeigen",
|
|
109
|
+
"ru": "Показывать имя",
|
|
110
|
+
"pt": "Mostrar nome",
|
|
111
|
+
"nl": "Naam weergeven",
|
|
112
|
+
"fr": "Afficher le nom",
|
|
113
|
+
"it": "Mostra nome",
|
|
114
|
+
"es": "Mostrar nombre",
|
|
115
|
+
"pl": "Pokaż nazwę",
|
|
116
|
+
"uk": "Показувати ім'я",
|
|
117
|
+
"zh-cn": "显示名称"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"showDetails": {
|
|
121
|
+
"type": "checkbox",
|
|
122
|
+
"default": true,
|
|
123
|
+
"label": {
|
|
124
|
+
"en": "Show temperature, battery and quality",
|
|
125
|
+
"de": "Temperatur, Batterie und Qualität anzeigen",
|
|
126
|
+
"ru": "Показывать температуру, батарею и качество",
|
|
127
|
+
"pt": "Mostrar temperatura, bateria e qualidade",
|
|
128
|
+
"nl": "Temperatuur, batterij en kwaliteit weergeven",
|
|
129
|
+
"fr": "Afficher température, batterie et qualité",
|
|
130
|
+
"it": "Mostra temperatura, batteria e qualità",
|
|
131
|
+
"es": "Mostrar temperatura, batería y calidad",
|
|
132
|
+
"pl": "Pokaż temperaturę, baterię i jakość",
|
|
133
|
+
"uk": "Показувати температуру, батарею та якість",
|
|
134
|
+
"zh-cn": "显示温度、电池和质量"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"lowPct": {
|
|
138
|
+
"type": "number",
|
|
139
|
+
"min": 0,
|
|
140
|
+
"max": 100,
|
|
141
|
+
"default": 20,
|
|
142
|
+
"label": {
|
|
143
|
+
"en": "Warning below (%)",
|
|
144
|
+
"de": "Warnung unter (%)",
|
|
145
|
+
"ru": "Предупреждение ниже (%)",
|
|
146
|
+
"pt": "Aviso abaixo de (%)",
|
|
147
|
+
"nl": "Waarschuwing onder (%)",
|
|
148
|
+
"fr": "Avertissement en dessous de (%)",
|
|
149
|
+
"it": "Avviso sotto (%)",
|
|
150
|
+
"es": "Aviso por debajo de (%)",
|
|
151
|
+
"pl": "Ostrzeżenie poniżej (%)",
|
|
152
|
+
"uk": "Попередження нижче (%)",
|
|
153
|
+
"zh-cn": "低于此值时警告 (%)"
|
|
154
|
+
},
|
|
155
|
+
"help": {
|
|
156
|
+
"en": "The bottle turns yellow below this fill level and red below half of it",
|
|
157
|
+
"de": "Unter diesem Füllstand wird die Flasche gelb, unter der Hälfte davon rot",
|
|
158
|
+
"ru": "Ниже этого уровня баллон становится жёлтым, ниже его половины — красным",
|
|
159
|
+
"pt": "Abaixo deste nível a botija fica amarela, abaixo de metade dele fica vermelha",
|
|
160
|
+
"nl": "Onder dit vulniveau wordt de fles geel, onder de helft ervan rood",
|
|
161
|
+
"fr": "En dessous de ce niveau la bouteille devient jaune, en dessous de la moitié rouge",
|
|
162
|
+
"it": "Sotto questo livello la bombola diventa gialla, sotto la metà rossa",
|
|
163
|
+
"es": "Por debajo de este nivel la bombona se vuelve amarilla, por debajo de la mitad roja",
|
|
164
|
+
"pl": "Poniżej tego poziomu butla robi się żółta, poniżej jego połowy czerwona",
|
|
165
|
+
"uk": "Нижче цього рівня балон стає жовтим, нижче його половини — червоним",
|
|
166
|
+
"zh-cn": "低于此液位时气罐显示黄色,低于其一半时显示红色"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="bottle" viewBox="0 0 100 184" preserveAspectRatio="xMidYMid meet" role="img" aria-label=""><defs><style>.metal{fill:#9aa5b1;stroke:#52606d;stroke-width:2}.body{fill:#e4e7eb}.outline{fill:none;stroke:#52606d;stroke-width:2.5}.seam{stroke:#52606d;stroke-opacity:.35;stroke-width:1.5}.valve{fill:#3e4c59}.liquid{fill:#2e9f5b}.surface{fill:#7fd6a0}.label,.sublabel{display:none}</style><clipPath id="mopeka-body-icon"><path d="M14 64C14 44 30 36 50 36S86 44 86 64V154C86 166 72 170 50 170S14 166 14 154Z"/></clipPath><linearGradient id="mopeka-shine-icon" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="#fff" stop-opacity=".04"/><stop offset=".22" stop-color="#fff" stop-opacity=".32"/><stop offset=".46" stop-color="#fff" stop-opacity="0"/><stop offset="1" stop-color="#000" stop-opacity=".16"/></linearGradient></defs><g class="art"><rect class="metal" x="24" y="158" width="52" height="24" rx="3"/><path class="metal" fill-rule="evenodd" d="M34 6h32a6 6 0 0 1 6 6v26H28V12a6 6 0 0 1 6-6Zm4 6a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h24a3 3 0 0 0 3-3v-4a3 3 0 0 0-3-3Z"/><path class="body" d="M14 64C14 44 30 36 50 36S86 44 86 64V154C86 166 72 170 50 170S14 166 14 154Z"/><g clip-path="url(#mopeka-body-icon)"><rect class="liquid ok" x="0" y="82.90" width="100" height="87.10"/><rect class="surface ok" x="0" y="82.90" width="100" height="2.5"/><rect x="0" y="0" width="100" height="184" fill="url(#mopeka-shine-icon)"/></g><path class="seam" d="M14.5 104H85.5"/><path class="outline" d="M14 64C14 44 30 36 50 36S86 44 86 64V154C86 166 72 170 50 170S14 166 14 154Z"/><rect class="valve" x="44" y="24" width="12" height="14" rx="2"/></g><text class="label" x="50" y="112" text-anchor="middle"></text></svg>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DeviceManagement, type DeviceDetails, type DeviceLoadContext, type InstanceDetails } from '@iobroker/dm-utils';
|
|
2
|
+
import type { AdapterInstance } from '@iobroker/adapter-core';
|
|
3
|
+
import type { MopekaAdapterConfig, SensorEntry } from '../types';
|
|
4
|
+
import type { ScanDevice } from './source';
|
|
5
|
+
/** What the device manager needs from the adapter */
|
|
6
|
+
export interface MopekaAdapterApi extends AdapterInstance {
|
|
7
|
+
config: MopekaAdapterConfig;
|
|
8
|
+
/** Device ID of a sensor relative to the instance, e.g. `sensors.Gas_left` */
|
|
9
|
+
getDeviceId(sensor: SensorEntry): string;
|
|
10
|
+
scanSensors(): Promise<ScanDevice[]>;
|
|
11
|
+
updateSensors(mutate: (sensors: SensorEntry[]) => SensorEntry[]): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare class MopekaDeviceManagement extends DeviceManagement<MopekaAdapterApi> {
|
|
14
|
+
private full;
|
|
15
|
+
private getSensors;
|
|
16
|
+
private findSensor;
|
|
17
|
+
protected getInstanceInfo(): InstanceDetails;
|
|
18
|
+
protected loadDevices(context: DeviceLoadContext<string>): void;
|
|
19
|
+
protected getDeviceDetails(id: string): Promise<DeviceDetails<string> | null | {
|
|
20
|
+
error: string;
|
|
21
|
+
}>;
|
|
22
|
+
private getIndicators;
|
|
23
|
+
/** The gas bottle on the card; name and values are shown by the card itself */
|
|
24
|
+
private getCustomInfo;
|
|
25
|
+
private getSensorInfo;
|
|
26
|
+
private stateItem;
|
|
27
|
+
private staticItem;
|
|
28
|
+
private header;
|
|
29
|
+
private getSensorDetails;
|
|
30
|
+
private mediumOptions;
|
|
31
|
+
private onScan;
|
|
32
|
+
private onEdit;
|
|
33
|
+
}
|