Hi everyone,
I’m a total beginner and just started learning Homey app development today.
I’m trying to create the simplest pairing page, but the Homey components like <homey-text> and <homey-number> for IP and Port just don’t show up.
Here is my driver.compose.json:
{
"id": "wifi-light-v2",
"name": {
"en": "WiFi Smart Bulb v2"
},
"class": "light",
"capabilities": [
"dim",
"onoff"
],
"platforms": [
"local"
],
"connectivity": [
"lan"
],
"pair": [
{
"id": "enter-credentials",
"type": "html",
"name": {
"en": "Enter Info"
},
"description": {
"en": "Please enter IP and Port"
}
}
]
}
And here is my enter-credentials.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Enter WiFi Bulb Info</title>
<script src="/homey.js" data-origin="pair"></script>
</head>
<body>
<h1>Enter WiFi Bulb Information</h1>
<!-- Homey official components -->
<homey-text id="bulb_ip" label="Bulb IP" placeholder="192.168.1.100"></homey-text>
<homey-number id="bulb_port" label="Port" value="80"></homey-number>
<button id="save">Save</button>
<script>
Homey.setTitle('Enter WiFi Bulb Information');
document.getElementById('save').addEventListener('click', async () => {
const bulb_ip = Homey.getValue('bulb_ip');
const bulb_port = Homey.getValue('bulb_port');
if (!bulb_ip) {
return Homey.alert('Please enter Bulb IP');
}
const portNumber = Number(bulb_port);
if (!Number.isInteger(portNumber) || portNumber < 1 || portNumber > 65535) {
return Homey.alert('Please enter a valid port (1-65535)');
}
try {
await Homey.emit('save', { bulb_ip, bulb_port });
Homey.done();
} catch (err) {
Homey.alert(err && err.message ? err.message : String(err));
}
});
</script>
</body>
</html>
And here is my directory structure:
📁 .homeycompose
📄 app.json
📁 capabilities
📁 discovery
📁 drivers
📁 settings
📁 templates
📁 flow
📁 actions
📁 conditions
📁 triggers
📁 locales
📁 screensavers
📁 signals
📁 433
📁 868
📁 ir
📁 drivers
📁 wifi-light-v2
📁 assets
📁 images
📄 device.js
📄 driver.compose.json
📄 driver.js
📁 pair
📄 enter-credentials.html
Thanks in advance — looking forward to learning from you all!
