Homey Community Forum

Homeyduino: setCapabilityValue does not change Homey state?

Hi, I have a simple homeyduino project. And I want to change a capability state in Homey. But Homey does not change the state.

In the setup I have:
Homey.addCapability("onoff", AlarmOnOff);
And this works fine to trigger the arduino.

But when I try to set the capablility inside Arduino and want to change the state in Homey, noting happens.
I tried:
Homey.setCapabilityValue("onoff", false);
or
Homey.setCapabilityValue("onoff", 0);
or
Homey.setCapabilityValue("onoff", "0");
None of them seem to change the state of the tile. What am I missing?

Homey.setCapabilityValue(“alarm_smoke”, (bool) false); works for me.

Are you calling Homey.loop() from inside the loop() method? Have you called setClass()?

Yes (otherwise control from Homey would not work either)

No, is this mandatory? According to the usage guide it defaults to “other”:

I’ll set the setclass and report if it makes a difference.

I shall try this syntax. Maybe “onoff” isn’t settable? (according to the documentation it is).

Well… it turns out it is. if I add:
Homey.setClass("socket");
it works…
But also when I change it to:
Homey.setClass("other");
So it does not default to other even when the documentation stated this. :roll_eyes:

Looking at the code, it does.

Then I think it’s some kind of capability caching inside homey even though I removed the device and re-add it. (I did not change the name of the device). If I block out the setclass instruction (basically the old code again) it keeps on working… weird. Ill keep it to “socket” just to be safe.