minor changes and fixes, adjusted frontend

This commit is contained in:
katsu 2025-06-26 14:14:19 +02:00
parent d00651a66c
commit acc38950e7
11 changed files with 99 additions and 121 deletions

View file

@ -27,9 +27,12 @@ function lockServicePage() {
}
//TODO display none namest uno
</script>
<template>
<div style="">
<div v-if="currentRoom == 'none'">
<h1>Incorrect or missing room parameter!</h1>
</div>
@ -48,19 +51,24 @@ function lockServicePage() {
</VerticalTabs>
<large style="display: flex;">turbo odličen super mega kontrol panel</large>
</header>
<main>
<MainPage v-if="pageNum == 0" :room="currentRoom" />
<VideoPage v-else-if="pageNum == 1" :room="currentRoom" />
<main style="flex-grow: 1">
<MainPage :class="{'hiddenPage': pageNum != 0}" :room="currentRoom" />
<VideoPage :class="{'hiddenPage': pageNum != 1}" :room="currentRoom" />
<LightingPage v-else-if="pageNum == 3" :room="currentRoom" />
<LightingPage :class="{'hiddenPage': pageNum != 3}" :room="currentRoom" />
<ServisPage v-else-if="pageNum == 4" :room="currentRoom" />
<ServisPage :class="{'hiddenPage': pageNum != 4}" :room="currentRoom" />
</main>
</div>
</div>
</template>
<style scoped>
.hiddenPage {
display: none !important
}
#wrapper {
width: 100%;
height: 100%;

View file

@ -42,7 +42,7 @@ function handleIncStatus(typ: string, msg: string) {
//console.log(projStatus)
if (typ == 'power') { roomStatus.proj_power = msg == '1' }
else if (typ == 'platno') { roomStatus.platno_state = msg }
else if (typ == 'lift') { roomStatus.lift_state = msg }
//else if (typ == 'lift') { roomStatus.lift_state = msg }
}
onMounted(() => {
@ -73,12 +73,12 @@ async function setLecture(pos?: String) {
} // else if (roomState.value == 1) {
// command = '0'
// } else { return }
publishMQTTMsg((topicPref + 'set/power'), command)
publishMQTTMsg((topicPref + 'command/power'), command)
publishMQTTMsg((topicPref + 'platno/goto'), command == '1' ? 'DOWN' : 'UP')
publishMQTTMsg((topicPref + 'lift/move/' + (command == '1' ? 'down' : 'up') ), '1')
publishMQTTMsg((topicPref + 'lift/move/' + (command == '1' ? 'down' : 'down') ), '1')
await sleep(1000)
publishMQTTMsg((topicPref + 'platno/goto'), 'STOP')
publishMQTTMsg((topicPref + 'lift/move/' + (command == '1' ? 'down' : 'up') ), '0')
// publishMQTTMsg((topicPref + 'platno/goto'), 'STOP')
publishMQTTMsg((topicPref + 'lift/move/' + (command == '1' ? 'down' : 'down') ), '0')
}
@ -87,7 +87,7 @@ async function setLecture(pos?: String) {
const roomStatus = reactive({
proj_power: false,
lift_state: 'UNKNOWN',
//lift_state: 'UNKNOWN',
platno_state: 'UNKNOWN',
})
@ -98,9 +98,9 @@ const roomState = ref(0)
watch (roomStatus, (_, _newState) => {
if (!_newState) { return }
let allOn = _newState.proj_power && _newState.platno_state == 'DOWN' && _newState.lift_state == 'DOWN'
let allOff = !_newState.proj_power && _newState.platno_state == 'UP' && _newState.lift_state == 'UP'
let anyUnknown = _newState.lift_state == 'UNKNOWN' || _newState.platno_state == 'UNKNOWN'
let allOn = _newState.proj_power && _newState.platno_state == 'DOWN' //&& _newState.lift_state == 'DOWN'
let allOff = !_newState.proj_power && _newState.platno_state == 'UP' //&& _newState.lift_state == 'UP'
let anyUnknown = _newState.platno_state == 'UNKNOWN'
if (allOn) {
roomState.value = 1
} else if (allOff) {
@ -130,7 +130,7 @@ watch (roomStatus, (_, _newState) => {
</div>
<h6>Projektor status: {{ roomStatus.proj_power ? "ON" : "OFF" }}</h6>
<h6>Platno pozicija: {{ roomStatus.platno_state }}</h6>
<h6>Dvigalo pozicija: {{ roomStatus.lift_state }}</h6>
<!-- <h6>Dvigalo pozicija: {{ roomStatus.lift_state }}</h6>-->
</div>
</template>

View file

@ -26,7 +26,7 @@ const MasterStatus = ref(false)
function handleIncomingMQTT(topic: string, msg: string) {
console.log('Received on', topic, 'with message', msg)
audioStatus.value = msg == '1'
MasterStatus.value = msg == '1'
}
onMounted(() => {
@ -43,7 +43,7 @@ function publishMQTTMsg(topic: string, msg: string) {
}
async function setMaster() {
let topicPref = props.room + "/power/audio/set"
let topicPref = props.room + "/power/master/set"
let command = '0'
if (!MasterStatus.value) {
command = '1'

View file

@ -88,9 +88,7 @@ const publishPrefix = ref(props.room + '/')
</script>
<template>
<div style="display: flex; gap: 1rem">
</div>
<div>
<div style="display:flex; gap: 1rem">
<div>
<h4>Firanki</h4>
@ -117,6 +115,7 @@ const publishPrefix = ref(props.room + '/')
<button :class="{currentlySelectedPreset: (lastPreset == '9')}" @click="publishMQTTMsg(publishPrefix + 'lucke/preset/recall', 'F')"A>Plchldr F</button>
</div>
</div>
</div>
</template>
<style scoped>

View file

@ -29,8 +29,6 @@ let _stranski = ref('side')
<h4>Stranski:</h4>
<LectureModule :room="props.room" :position="_stranski" />
</div>
</div>
<div>
<AudioControlModule :room="props.room" />
</div>
</template>