Le_Gal
(Le Gal)
June 20, 2017, 12:43pm
1
Hello,
please help how can I add third state to window (ajar).
(In my windows I have installed 2 contactrons as 2 different zones in satel, so I know if window is opened or ajar). I’ve read to use string, but I’m not sure how to set the string with 2 zones.
And which icon or item type should I use for PIR state, to see if it is validated?
Thanks in advanced.
rlkoshak
(Rich Koshak)
June 20, 2017, 4:43pm
2
Please post your Items Definitions as they are now.
At a high level you need to use a String Item to represent the state of the Window. You will only update this Item with the words “ajar”, “open” and “closed” and use the icon “window”.
You will need a rule to interpret the states of the contacts into one of the three states.
Le_Gal
(Le Gal)
June 21, 2017, 11:31am
3
Hello, thank You for reply
My items right now:
Contact Zone2 “PIR saloon violated” (Zones) { satel=“zone:violation:2” }
Contact Zone9 “Okno sypialnia lewe” (Zones) { satel=“zone:violation:9” }
Contact Zone10 “Roof Window Bedroom right (above bad)” (Zones) { satel=“zone:violation:10” }
Contact Zone18 “PIR Bedroom” (Zones) { satel=“zone:violation:18” }
Contact Zone6 “Roof Window Tiga” (Zones) { satel=“zone:violation:6” }
Contact Zone23 “Tigers Window Tilted” (Zones) { satel=“zone:violation:23” }
Contact Zone24 “Tigers Window Opened” (Zones) { satel=“zone:violation:24” }
Contact Zone19 “Guest Window Tilted” (Zones) { satel=“zone:violation:19” }
Contact Zone20 “Guest Window Opened” (Zones) { satel=“zone:violation:20” }
Contact Zone21 “PIR Guest room” (Zones) { satel=“zone:violation:21” }
As You see I have “PIRs” as “contact” so it doesn’t look logic,
and I’ve made 2 different items for opened and ajar window (where ajar has opened icon, which is not logic too).
rlkoshak
(Rich Koshak)
June 21, 2017, 4:52pm
4
So, like I said, you need to add a String Item for each window.
Contact Zone19 "Guest Window Tilted" (Zones) { satel="zone:violation:19" }
Contact Zone20 "Guest Window Opened" (Zones) { satel="zone:violation:20" }
String Guest_Window "Guest Window [%s]" <window>
And a Rule to convert the two sensors to the word state of the window:
rule "Guest Window state"
when
Item Zone19 changed or
Item Zone20 changed
then
var newState = "closed"
if(Zone19.state == OPEN && Zone20.state == OPEN) newState = "open"
else if(Zone19.state == OPEN && Zone20.state == CLOSED) newState = "ajar"
Guest_Window.postUpdate(newState)
end
Le_Gal
(Le Gal)
June 21, 2017, 9:32pm
5
THANK YOU THANK YOU THANK YOU!!!
Works like charm even better!
Because now I get text state all the time, AWESOME!
Do You know how to configure PIR motion sensors, so I could see it’s state changed?
PS (for somebody else reading)
in sitemap I’ve added:
Default item=Guest_Window
rlkoshak
(Rich Koshak)
June 21, 2017, 9:43pm
6
Just add them to your sitemap.
Text item="Zone21" label="PIR Guest room [%s]" icon="presence"
Le_Gal
(Le Gal)
June 21, 2017, 10:13pm
7
Did You mean “present” (I don’t see presence icon)?
Text item=Zone21 label=“PIR Guest room [%s]” icon=“present”
With your string I can finally get text state change but icon doesn’t change.
rlkoshak
(Rich Koshak)
June 21, 2017, 10:15pm
8
I did mean present and it appears that the default present icons only works with Switch Items.
Le_Gal
(Le Gal)
June 21, 2017, 10:25pm
9
Ok, so I’ll just use “motion” icon, which will not change, but that’s ok because now I get state change by text.
Thank You a lot! Greets from Poland.