Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Publish an Event
Copy Markdown
Open in ChatGPT
Open in Claude
Events are interactions from your device e.g. temperature, humidity, door opened, etc.
To send an event to Wia, connect to the MQTT API and publish it to the events topic.
The events MQTT topic is: events or devices/{DEVICE_ID}/events/{EVENT_NAME}
Example code
Publish an Event using the Wia SDK
// Create an instance of Wia
// Replace 'd_sk_abcdef' with your device secret key
var wia = require('wia')('d_sk_abcdef');
// Listen for a successful connection to the MQTT API
wia.stream.on('connect', function() {
// Publish an event
wia.events.publish({
name: 'temperature',
data: 21.5
});
});
// Connect to the MQTT API
wia.stream.connect();
Last updated on
Next to read:
Subscribe to Eventsnull
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message
