Narete stvari da delajo

This commit is contained in:
Miha Frangež 2025-09-12 17:43:50 +02:00
parent 64a10b0512
commit 29b2beca5a
45 changed files with 809 additions and 1600 deletions

View file

@ -42,6 +42,8 @@ function handleIncomingMQTT(topic: string, msg: string) {
function handleProjectorStatus(typ: string, msg: string) {
console.log('handling status')
//console.log(projStatus)
console.debug(props.room, projStatus.power, projStatus.shutter)
if (typ == 'power') { projStatus.power = msg == '1' }
else if (typ == 'shutter') { projStatus.shutter = msg == '1' }
else if (typ == 'freeze') { projStatus.freeze = msg == '1' }
@ -62,7 +64,7 @@ function publishMQTTMsg(topic: string, msg: string) {
const publishPrefix = ref(props.room + '/projectors/' + props.position + '/command/')
const publishPrefix = ref(props.room + '/projectors/' + props.position + '/set/')
//TODO organize better, binds, etc.
@ -80,18 +82,18 @@ const projStatus = reactive({
<!-- TODO lepš -->
<div>
<h4>Power</h4>
<button @click="publishMQTTMsg(publishPrefix + 'power', (!projStatus.power ? '1' : '0'))">
<button @click="publishMQTTMsg(publishPrefix + 'power', (!projStatus.power ? '1' : '0'))" :class="{currentlyActive: projStatus.power}">
Turn {{ projStatus.power ? 'OFF' : 'ON' }}</button>
</div>
<div :class="{ disabled: !projStatus.power }">
<div>
<h4>Shutter</h4>
<button @click="publishMQTTMsg(publishPrefix + 'shutter', (!projStatus.shutter ? '1' : '0'))">
<button @click="publishMQTTMsg(publishPrefix + 'shutter', (!projStatus.shutter ? '1' : '0'))" :class="{currentlyActive: projStatus.shutter}">
Turn {{ projStatus.shutter ? 'OFF' : 'ON' }}</button>
</div>
<div>
<h4>Freeze image</h4>
<button @click="publishMQTTMsg(publishPrefix + 'freeze', (!projStatus.freeze ? '1' : '0'))">
<button @click="publishMQTTMsg(publishPrefix + 'freeze', (!projStatus.freeze ? '1' : '0'))" :class="{currentlyActive: projStatus.freeze}">
Turn {{ projStatus.freeze ? 'OFF' : 'ON' }}</button>
</div>
</div>