Possible Typo/Correction in Manual
-
Hi @toggledbits,
I had an idea about my Echo speaking which windows or doors are open when an announcement is made reminding the family to close things up when it is hotter outside. Let me start off by saying I'm not great with expressions and in no way any programmer. To get started I read the How To: Expressions and what do you know, you have an example on how to do exactly what I am looking for. However I think I found a typo/correction that may be needed? Again, not a programmer here.
In the How To: Expressions with Entities section you state the new expression called open_perimeter_doors and give the example with the end of null : doorid. In the description you state you order them this way because when the door_sensor.state is true, the door is closed/secure. I have a few different brands of contact sensors and all of them are just the opposite. They are true when they are open and false when they are closed. For me, this was an easy fix. I swapped them.
What blew my mind and took a bit of thinking was a little further down in your example of joining the getEntity ID and getName.
join( each doorid in perimeter_doors: do e = getEntity( doorid ), e.attributes.door_sensor.state ? null : e.getName() done , ", " )
The "e.getName()" in the example would cause the expression to never evaluate. I needed to change this to "e.name". With e already being set as "getEntity( doorid )", only name was needing to be appended. In your example you are appending ".getName()", resulting in "getEntity( doorid).getName()"
Again, NOT a programmer, but perhaps a stale How To example from before a major update to the expression logic? Just wanted to share my results in case the manual does need an update.
-
Yeah, that's a carry over from the Vera Reactor plugin (R4V)... the docs for MSR started from R4V and got edited, and I missed that. Apologies, but darned good sleuthing on your part to find the correct thing. You are awarded 10 XP!
-
T toggledbits locked this topic on