HomeyScript looking for testers

We are looking for some test users for the new HomeyScript version HomeyScript | Homey that uses our new homey-api - npm library under the hood for new scripts.

All old scripts will keep working and can be upgraded but it’s not necessary. To upgrade scripts the following guide can be followed. Tutorial: Migrating deprecated scripts - HomeyScript (athombv.github.io)

This has been a pain point for some time since the web api docs have been for our new api but HomeyScript was still using the old one.

Let us know if you encounter any bugs or if anything is unclear.


Hi Jero!

I’m trying to migrate a script in which I fetch variables from the app “Better Logic Library”, but I get an error saying “TypeError: BLApp.apiGet is not a function”. I can’t find anything in the migration guide regarding this and I don’t know if the error is in my code, the HS-app or that the BLL-app needs to be updated to support this.

My code (which works fine in the classic script) is:
let BLApp = await Homey.apps.getApp({id: “net.i-dev.betterlogic”});
let BLVar = await BLApp.apiGet(“/Ecodan_DHW_Temp_Offset/”);


1 Like

Thank you for reporting this I will look into it

Tutorial: Migrating deprecated scripts - HomeyScript I’ve updated the docs see step 6.


Step 6, not a day too early… I have been struggling A LOT with the deprecated apiPost function.

Have a look at this screenshot, you’re saying that “apiPost” has been replaced with “post”, but I still get a recommendation to use apiPost (that does not work)?

And the code above does not work either with “post”:

A bit frustrating that you change things without a proper documentation.

I want to run a HomeyScript from another HomeyScript - how do I do that nowadays?

Hi Peter,

Please check the docs again on step 6 the function signature has changed. The argument is an object with a path property.


OK, but do you mind giving me an example?

The ID of the script I want to run is “5d461f9b-37e9-44c8-8ff5-5e2aa5861302”.

await todaysSoldElectricity.post({ path: 'script/5d461f9b-37e9-44c8-8ff5-5e2aa5861302/run' });

Great, thanks! :slight_smile:

1 Like

Thanks a lot @Jero - very appreciated!

I hope you have time to answer my final question as well :slight_smile:

Consider this code:

let dcApp = await Homey.apps.getApp({id:'nl.qluster-it.DeviceCapabilities'});
await dcApp.apiPost('setvalue', {device:'c34dc5b4-3c30-48a9-8a4e-014aea93d00d', field:'measure_power', value:501});

Is it possible to rewrite this to fit into the new API, or do the developer need to make any changes?

I have tried without any luck.


Try this:

let dcApp = await Homey.apps.getApp({ id: 'nl.qluster-it.DeviceCapabilities' });
await dcApp.apiPost({
  path: 'setvalue',
  body: {
    device: 'c34dc5b4-3c30-48a9-8a4e-014aea93d00d',
    field: 'measure_power',
    value: 501,

Read The Fine Migration Guide, step 6.

Works flawless @Jero - thank you so much! It should be “post” though, not “apiPost” :joy:

Yeah, but that was recently added, I’ve tried to migrate everything without this documentation. That said, it didn’t help me either, but that’s my bad :blush:

Some feedback @Jero.

Reading and writing to the same fields in a virtual device, without any async functions, worked perfectly before.

If you do it now, the HomeyScript app crashes. The app is really prone to crash when you do read and write operations like this in the same script - it’s the same if you try to write through the runFlowCardAction function.

This code will crash the HomeyScript app:

var currentElectricityConsumptionKwh = null;

const currentValueDevice1 = await Homey.devices.getDevice({ $skipCache: true, id: 'faaede90-c616-40e7-a1ce-ce72069943cb' });
  const currentAvdDevice1 = currentValueDevice1.makeCapabilityInstance('measure_devicecapabilities_number-custom_35.number4');
  currentElectricityConsumptionKwh = currentAvdDevice1.value;

var currentElectricityCostKr = null;

  const currentValueDevice2 = await Homey.devices.getDevice({ $skipCache: true, id: 'faaede90-c616-40e7-a1ce-ce72069943cb' });
  const currentAvdDevice2 = currentValueDevice2.makeCapabilityInstance('measure_devicecapabilities_number-custom_35.number3');
  currentElectricityCostKr = currentAvdDevice2.value;

let dcApp1 = await Homey.apps.getApp({ id: 'nl.qluster-it.DeviceCapabilities' });
await dcApp1.post({
  path: 'setvalue',
  body: {
    device: 'faaede90-c616-40e7-a1ce-ce72069943cb',
    field: 'measure_devicecapabilities_number-custom_35.number3',
    value: 1,

let dcApp2 = await Homey.apps.getApp({ id: 'nl.qluster-it.DeviceCapabilities' });
await dcApp2.post({
  path: 'setvalue',
  body: {
    device: 'faaede90-c616-40e7-a1ce-ce72069943cb',
    field: 'measure_devicecapabilities_number-custom_35.number4',
    value: 2,

Thank you will check tomorrow.

1 Like

Did you found any time to have a look at this @Jero? Thanks!

Why are you creating a capability listener without a callback if you want to read the value of a capability you can just do currentValueDevice2.capabilitiesObj.measure_devicecapabilities_number-custom_35.number3.value

Device - Homey Web API (athombv.github.io) as you can see here you are calling the function wrong. Also using a listener in a script is not needed since a script just runs to completion and destroys the listeners.

Not sure if I’m reading the signature wrong, but what are the opts suppose to be doing?

because at first I thought I can specify certain props and it will filter by it, but it just returns all devices. Also giving it a complete parameter it does not do anything. Please either expand on the documentation or remove such parameters if they serve no function.

await Homey.devices.getDevices({ filter: { name: 'Arbeitsplatz' }});
await Homey.devices.getDevices({ filter: await Homey.devices.getDevices()[0] });

EDIT: this also applies to many other getXXXs functions.

The actual documentation doesn’t show any arguments.