Skip to content

Commit

Permalink
whyticketcounter
Browse files Browse the repository at this point in the history
  • Loading branch information
psy0rz committed Dec 29, 2024
1 parent 31411e6 commit c4ccece
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ledder/animations/TicketCounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,24 @@ export default class Template extends Animator {
console.log(`MQTT: ${mqttHost.text} connected`)

mqttClient.subscribe(mqttTopic.text)
mqttClient.subscribe('why2025/ticketshop/quotas/Event Visitors/pending_orders')
})

let paidCount=undefined
let pendingCount=undefined
mqttClient.on('message', async (topic, messageBuf) => {


let message = messageBuf.toString()
console.log("MQTT:", message)
counter.update(message)

if (topic==='why2025/ticketshop/quotas/Event Visitors/paid_orders')
paidCount=Number(message)

if (topic==='why2025/ticketshop/quotas/Event Visitors/pending_orders')
pendingCount=Number(message)

if (paidCount !==undefined && pendingCount!==undefined)
counter.update(paidCount+pendingCount)
})
}
}

0 comments on commit c4ccece

Please sign in to comment.