Issue with Homey.logic.updateVariable: "Missing Parameter: variable"

Hi everyone, I’m encountering an issue with the Homey.logic.updateVariable function in my Homey script. I’m trying to update a logic variable named conteggio_eventi. The variable is successfully retrieved with the following ID: 8bed27e2-2905-430b-91fe-36ca4d37d0a1.

Here’s what I’ve done so far:

  1. I successfully fetch logic variables using Homey.logic.getVariables().
  2. I confirm the variable’s ID and value.
  3. I call Homey.logic.updateVariable using the following formats:
  • { id: '8bed27e2-2905-430b-91fe-36ca4d37d0a1', value: 1 }
  • { variable: { id: '8bed27e2-2905-430b-91fe-36ca4d37d0a1', value: 1 } }

In both cases, I get the error: “Missing Parameter: variable”.

Here’s the output from the logs:

Attempting to update the “conteggio_eventi” variable
Object passed to updateVariable: { variable: { id: ‘8bed27e2-2905-430b-91fe-36ca4d37d0a1’, value: 1 } }
UpdateVariable: Error - Missing Parameter: variable

I’m unsure what parameter might be missing or if I’m using the wrong format. Has anyone had experience with this function and can help me resolve the issue?

Thank you in advance!
Ciao, Andrea

You seem to use a different syntax:

Homey.logic.updateVariable({id: TodaysDateId, variable: {'value' : dateNum}} )

2 Likes

THANK YOU! the script works now!