My homeyscript is executed every 1 minute, its purpose is to control all my thermostat valves for heating. I will just show a little code here where my ‘problem’ is.
i’ve got this code in my homeyscript:
Virtuele_Thermostaat_Badkamer=await Homey.devices.getDevice({id: ‘92d39e69-b6f3-4886-ba60-739b3967b01a’});
var badkamer_set=Virtuele_Thermostaat_Badkamer.capabilitiesObj[‘target_temperature’].value;
console.log("badkamer_set: "+badkamer_set);
The device Virtuele_Thermostaat_Badkamer is a virtual thermostat.
When i set this device to 20degrees and i check in the log, it is set at 20 .
But when i change the virtual thermostat again, to for example 16, badkamer_set stays at 20 in the log file and so all my thermostat valves staying at 20degrees instead of 16
when i check the information at the developer page for this device, there it is set at 16, so correct.
So i wonder, am i’m doing something wrong with declaring my variables?
Can someone point me in the correct direction please? THank you!!
Hi mate, could it be that getCapability does not exist anymore?
I’m receiving an error in my script when i use your code.
Script Error:
Missing required parameter: uri
If it says that uri is missing, the method obviously still exists, but perhaps Virtuele_Thermostaat_Badkamer.capabilitiesObj.target_temperature doesn’t contains the correct data.
Hi, i just tried your suggestion; but the problems remains the same
I’ve got the same problem for all my devices it seems (not updating) My measured temperatures from my smoke detectors are also not updating in Homeyscript, only in Homescript.
I’m using the measured_temperature from all my smoke sensors in my house to measure the temperature in every room. Every room has its own Eurotronic heating valves for the ‘radiators’ and with the Virtual Thermostat i can adjust the temperature in every room.
Before my system was running on a Raspberry Pi with Domoticz and i wrote my program completely in PHP and it worked fine; but i had problems with zwave range and raspberry pi, thats why i made the switch to Homey; but i hope i’m not getting stuck on this updating variable stuff, because it would be an very expensive switch
Now, back to this topic:
So i’m running a flow that is running every 1minute the Homeyscript
7minutes have passed and the console.log still show this:
first line is the date/time i’m printing so i now when the log has been ‘updated’
value in homeydash shows 21, in log below still 25
Homeyscript:
console.clear;
let tijdvar1=new Date();
console.log(tijdvar1);
const Virtuele_Thermostaat_Badkamer=await Homey.devices.getDevice({id: ‘92d39e69-b6f3-4886-ba60-739b3967b01a’});
console.log(Virtuele_Thermostaat_Badkamer.capabilitiesObj.target_temperature);
Also, in Homeyscript, everytime i press: Save&Test button
then it is updated, but when the Flow(that is running every 1minute) is running the Homeyscript, then the variables are not updated
What exactly is it that you’re trying to do? If you can explain what you’re trying to accomplish, I (or likely other people ) might be able to help you set up flows that will accomplish your goal.
well, i have 7rooms i want to control the heating seperatly.
So i had before was:
virtual button Manual Heating On/Off for every room
virtual thermostat for every room
I have any every room a temperature sensor (mostly it are smoke detectors from Fibaro who have temperature sensor also) So with this i know what i need to do
Every room has Eurotronic controlled valves (8° => closed ; 28° => completely open)
And my Vaillant heater is switched on/off with a zwave Fibaro relay
So an example:
actual temperature in room x => 15°C
So i want to switch on the heating manually for room x to 21°C (this is the virtual thermostat) for 2h (kids studying or something), so i push the manual button and then the heater switches on and the electronic valves are opening only in that room to maximum. all other valves are closed.
When the temperature has reached 21°C, the heater must switch off (unless another room is asking to be heated ofcourse)
When after 15min, the temperatures drops again to 20.5°C and it is still in range of the 2h limit, heater must switch on again.
This is the manual button heating.
Automatic heating:
i setup for example on weekdays: heating must switch on from 4:00 - 6:40 to 22°C on room x,a,b (all other rooms not needed)
after 6:40 heating must be switched off, because we are gone to work.
Hmm yeah, Homeyscript sounds like a better solution for this, with flows it would get too complicated.
I use capabilitiesObj in the Homeykit app, where it works, but the difference with that and your code is that Homeykit listens to capability change events before it reads out the value.
I don’t think you can run Homeyscript scripts continously, so listening to events won’t work. And like I said, capabilitiesObj is updated lazily, but I don’t know at which point Homey’s core decides to update it (perhaps only when there’s an event handler listener for changes, but stuff like this simply isn’t documented).
So, I’m just wondering. Am I the only person who is using Homey that want to ‘read’ the variables from its devices in Homeyscript? Because everyone must have the same problem like me that the variables are not updating?
If i could use the measured_temperature from my Fibaro smoke detectors in a Flow, i could continue a little bit, but for what i see i cant use the temperature
Second: you rock
Is it also possible to pass multiple arguments to the same script?
So i can pass all the current temperatures from my smoke detectors?
I’ve now passed 1 current temperature as an argument and i can use it now in my script, so very good