{{ sortby.sortby }}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/PanelMainBtn.vue b/src/components/PanelMainBtn.vue
index 816025d..b29321c 100644
--- a/src/components/PanelMainBtn.vue
+++ b/src/components/PanelMainBtn.vue
@@ -34,22 +34,22 @@
}
function doCmd(obj) {
- let defParts = [],
- cmd = obj.cmd,
- rp
-
- if(obj.type === 'cmd') {
- for(const device of props.devices) {
- defParts = device.split(':')
- rp = RegExp(defParts[0], 'g')
- if(rp.test(cmd)) cmd = cmd.replace(rp, defParts[1])
- }
+ let cmdList
+
+ if(obj.cmd) {
+ if(obj.type === 'cmd') {
+ cmdList = obj.cmd.split(';')
+ for(const [idx, cmd] of Object.entries(cmdList)) {
+ cmdList[idx] = cmd
+ for(const device of props.devices) cmdList[idx] = cmdList[idx].replace(device.split(':')[0], device.split(':')[1])
+ }
- fhem.request('text', cmd)
+ fhem.request('text', cmdList.join(';'))
+ }
+
+ if(obj.type === 'route') router.push({ name: 'devices', params: { view: obj.cmd }, query: router.currentRoute.value.query })
+ if(obj.type === 'url') window.open(obj.cmd, '_self')
}
-
- if(obj.type === 'route') router.push({ name: 'devices', params: { view: obj.cmd }, query: router.currentRoute.value.query })
- if(obj.type === 'url') window.open(obj.cmd, '_self')
}
function btnClick(evt) {
diff --git a/src/components/PanelMainMenu.vue b/src/components/PanelMainMenu.vue
index c8262d8..918fa5d 100644
--- a/src/components/PanelMainMenu.vue
+++ b/src/components/PanelMainMenu.vue
@@ -31,6 +31,8 @@
divider,
re
+ menuItems.value = []
+
for(const def of defs) {
vals = /^get/.test(def.name) ? await doCmd(def.name) : def.name
diff --git a/src/components/SettingsProps.vue b/src/components/SettingsProps.vue
index 81ae4bf..a274d78 100644
--- a/src/components/SettingsProps.vue
+++ b/src/components/SettingsProps.vue
@@ -158,31 +158,41 @@
jsonError: null
})
- watch(router.currentRoute, (val) => {
+ function editItem(val) {
let idx
- if(val.params.item) {
- idx = fhem.app.config[props.type].map((e) => e.name).indexOf(val.params.item)
-
- if(idx !== -1) {
- item.value = fhem.app.config[props.type][idx]
- settings.value.itemIdx = idx
-
- getReadings()
+ idx = fhem.app.config[props.type].map((e) => e.name).indexOf(val)
+
+ if(idx !== -1) {
+ item.value = fhem.app.config[props.type][idx]
+ settings.value.itemIdx = idx
- settings.value.extended = items.value[items.value.map((e) => e.idx).indexOf(idx)].advanced !== '-' ? true : false
+ getReadings()
- if(typeof item.value === 'object') {
- settings.value.jsonDef = JSON.stringify(item.value, null, '\t')
- settings.value.jsonError = null
- }
+ settings.value.extended = items.value[items.value.map((e) => e.idx).indexOf(idx)].advanced !== '-' ? true : false
- return
+ if(typeof item.value === 'object') {
+ settings.value.jsonDef = JSON.stringify(item.value, null, '\t')
+ settings.value.jsonError = null
}
- }
+
+ return
+ }
item.value = null
settings.value.panel = null
+ }
+
+ watch(router.currentRoute, (val) => {
+ if(val.params.item) editItem(val.params.item)
+ })
+
+ watch(() => fhem.app.isReady, (val) => {
+ if(val) {
+ if(router.currentRoute.value.params.item) editItem(router.currentRoute.value.params.item)
+ getFhemDevices()
+ }
+
}, { immediate: true })
function updatePanel(panel) {
@@ -269,11 +279,11 @@
fhem.app.config[props.type].push(props.type === 'panels' ? newPanel : newTemplate)
- editItem(settings.value.newItem)
+ gotoItem(settings.value.newItem)
settings.value.newItem = ''
}
- function editItem(val) {
+ function gotoItem(val) {
router.push({ name: 'settings', params: { tab: props.type, item: val }, query: router.currentRoute.value.query })
}
@@ -302,8 +312,6 @@
function copyBtn() {
toClipboard(settings.value.jsonDef)
}
-
- getFhemDevices()