Open bassiebulk opened 6 years ago
How do you actually do this? Is this via another app or are you changing the VD app? A difference between measure and target is indeed the setable. But that is set bij Athom who defines the capabilities. There is nothing I can do about that.
But when I set the temperature in a flow like this, it works:
Hi Arjan,
Sorry, I wasn't really clear. I have a hacked/rooted Eneco Toon (https://www.domoticaforum.eu/viewtopic.php?f=100&t=11235).
I wanted to use a Homeyscript-script to update the values of the Virtual Device. A flow is triggered every 5 minutes and starts this HomeyScript: `var url = "http://192.168.1.10/happ_thermstat?action=getThermostatInfo";
(async () => { const rawResponse = await fetch(url, { method: 'GET', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, }); const content = await rawResponse.json(); //console.log(content);
if (content.currentTemp !== null && content.currentTemp != '') { //let devices = await Homey.devices.getDevices(); //var virtualtoon = .find(devices, { "id": "12345-abcde-6789-fghij" }); //console.log(virtual_toon); //virtual_toon.setCapabilityValue('measure_temperature', currentTemp); //virtual_toon.setCapabilityValue('target_temperature', setTemp);
var currentTemp = content.currentTemp/100;
var setTemp = content.currentSetpoint/100;
var states = Array("Comfort", "Thuis", "Slapen", "Weg");
var state = states[content.activeState];
console.log(state);
await setTagValue("toon_current", {type: "number", title: "Temperatuur op Toon®"}, currentTemp);
await setTagValue("toon_set", {type: "number", title: "Ingestelde temp. op Toon®"}, setTemp);
await setTagValue("toon_status", {type: "string", title: "Status op Toon®"}, state);
}
})();
return true;`
As can be seen in the script I now return the values from the HomeyScript back to the flow using Tags. With the Tags from the HomeyScript I can update the VD in the flow. But I cannot update the values directly from the script (the part that is now commented-out).
Just tried overriding the capability met 'settable=true', but that did not change anything. At some point Homey has to notify the app that a capability is changed, but this change is not coming through. With all changes with V2, I will leave it for now and may try it again when V2 is more stable.
No worries, the Tag-option works fine for now. Yeah, I see Athom has some of your functionality now in the main app.
I cannot set the measured temp like this:
virtual_device.setCapabilityValue('measure_temperature', currentTemp);
I CAN set the target temp like this:virtual_device.setCapabilityValue('target_temperature', setTemp);
I think this is because the measure_temperature-capability has: "setable = false".