Help with a flow: When raining, notify which doors/windows are open

That looks all ok. You can try to make some printouts with console.log(). Perhaps the “device” object inside the loop. Check the .name attribute. Not that there is an additional space somewhere.

Did a test with my two sensors and the script works perfect.

That is the strange part. The device name is exactly the same. I also tried with console.log to display the text but it will always respond with false. Very strange…

Is the script processing the part inside the line above?
Can you print the windowText and check what’s filled in?

Hi RonnyW, you mean like this?


output is none

Just after the IF brackets { }. At the current place the variable is not alreasy set.

Try a Homey reset, script is tested ok (sorry for interfering)

I already tried that. A PTP reset. but that didn’t work…

still says that the windows are closed

Why not putting many console.log lines in your code, so you can see the different values at many places. ( I did this for device.name, you can use the result for copy-past )
Run this code by the Test command and you see directly if the values are as expected.

 // Vul hier al je contact sensors in, device.name == "Exacte sensornaam"
   // currentText = "Sensornaam"
   console.log("--Device--", device.name );  // to compare and see if there is no typing error
   if( device.name == "Deur Terras-Wnk")
   currentText = "Woonkamer Terras deur";
1 Like

Maybe try a diff on this script and yours?
This works OK

// Deur of raam nog open?

let devices = await Homey.devices.getDevices();
let windowText = "";
let currentText = "";
let logText = "";
let windowOpen = false;

_.some(devices, device => 
{

if(device.class == 'sensor')
{
if( device.capabilitiesObj &&
device.capabilitiesObj.alarm_contact &&
device.capabilitiesObj.alarm_contact.value )

{
currentText = "";

// Vul hier al je contact sensors in, device.name == "Exacte sensornaam"
// currenText = "Sensornaam"

console.log("--Device--", device.name ); // to compare and see if there is no typing error

if( device.name == "Deur Trap")
currentText = "Trap";

//if( device.name == "Deur Badkamer")
//currentText = "Badkamer";

if( device.name == "Raam Slaapkamer")
currentText = "Slaapkamerraam";

if( device.name == "Deur Koelkast")
currentText = "Koelkast";

if(currentText != ""){
windowOpen = true;

if(windowText=="")
windowText = currentText;

else
windowText = windowText + ", " + currentText;
}
}
}
});

if(windowOpen == true)
windowText = "De volgende deuren of ramen staan nog open: " + windowText;
else
windowText = "Alle deuren en ramen zijn dicht";

console.log(windowText);

// Creëer / update HomeyScript variabele
await tag("door_windowText", windowText);

return windowOpen;

he needs a boolean for the Flow! The text is already in the Tag.

I know, but the problem isn’t in that part of the code when testing the script in the console.
I’ve adjusted it.

Hi Peter,
This script also doens’t work for me, very strange…

Has “Balkondeur-ka” an inverse option?
Or, what happens if you close that door and then test the script?

When I close the door, the script also returns false. Invert sensor also doens’t change a thing.
I also tried reinstalling the Homeyscript app but still the same… :frowning:

PS. I also tried changing the name of the sensor but this also gives the same result…

Auch. That is odd.

What happens if you temporary replace the condition “not all contacts are off” with “Balkondeur-ke contact is on”

Or / else:
What happens if you create a virtual door contact, set it to alarm=true, and add it to the script’s sensor section?

And is “Thuis” the top level of your zones?

What happens if you create this flow and open up the Balkondeur-ke door?

It should be reported.

I will try tomorrow, thanks!

Could it maybe go wrong because I’ on the 7.4.1 firmware?; which firmware are you running?

YW.
I’ve updated to 7.4.1 just a the other day, so in theory it can’t really be an issue :upside_down_face:

Can you try to run the script ( with the extra console.log ) when all your door/window sensors are activated, the console.log should show them as
image

so you can see if the problem is with all the sensors or just this one you are testing now.

For me, Version 7.4.1. is running since 12-05 without problems.