Can GPT-4 write an app for Homey?

This is my question, is it able to do it for someone knows nothing or simple (basic) things on writing a code?

Perhaps ask ChatGPT itself?

3 Likes

As an AI language model, I don’t have the ability to write an app for a Homey Pro myself, but I can provide some guidance on the process.

Homey Pro is a smart home automation system that allows you to control and automate various devices in your home. To write an app for Homey Pro, you will need to have programming knowledge and be familiar with the Homey SDK.

Here are the general steps to write an app for Homey Pro:

  1. Set up a development environment: You will need to set up a development environment on your computer, which includes installing the Homey CLI (Command Line Interface) and Node.js.
  2. Create a new app: Use the Homey CLI to create a new app and set up the basic structure.
  3. Define the capabilities: Define the capabilities that your app will support, such as turning on/off lights, controlling temperature, or playing music.
  4. Write the code: Write the code that will implement the functionality of your app.
  5. Test the app: Test your app on a Homey Pro device or simulator to ensure it is functioning properly.
  6. Publish the app: Once you are satisfied with your app, you can publish it to the Homey app store so that other Homey Pro users can install and use it.

Note that the process of writing an app for Homey Pro can be complex and time-consuming. It’s important to have a good understanding of the Homey SDK and programming concepts before attempting to develop an app.

1 Like

:smiley: Nice answer from GPT.

I was just working on it too. Homey scripts seems to write chatgpt without any problems; My attempt to calculate the average temperature of all devices that have the ability to measure temperature. Bit of a question and answer game with the following outcome. As a non programmer I probably wouldn’t have managed to do this myself without help.

/*
 * In this script we print the average temperature of all temperature sensors rounded to the nearest degree and a list of devices with their individual temperature in a tab-separated list.
 */

// Get all devices
const devices = await Homey.devices.getDevices();

// Create an array to store the temperatures
let temperatures = [];

// Create an object to store the devices with their temperatures
let deviceTemperatures = {};

// Loop over all devices
for (const device of Object.values(devices)) {

  // If this device isn't available, skip it.
  if (!device.capabilitiesObj) continue;

  // If this device is a temperature sensor
  if (device.capabilitiesObj.measure_temperature) {
    const temperature = device.capabilitiesObj.measure_temperature.value;
    temperatures.push(temperature);
    deviceTemperatures[device.name] = temperature;
  }
}

// Calculate the average temperature rounded to the nearest degree
const averageTemperature = Math.round(temperatures.reduce((acc, curr) => acc + curr, 0) / temperatures.length);

// Log the average temperature
console.log(`The average temperature of all temperature sensors is currently ${averageTemperature}°C.`);

// Log the devices with their temperatures in a tab-separated list
console.log('\n=== Device temperatures ===');
console.log('Device name\tTemperature (°C)');
for (const [deviceName, temperature] of Object.entries(deviceTemperatures)) {
  console.log(`${deviceName}\t${temperature}`);
}
5 Likes