code:
if (contactSensor) ind = (contactSensor.currentValue("contact").contains('closed') ? 1 : 0);
else ind = -1
log:
app:16 2018-03-06 13:09:55.696:errorCommand ācurrentValueā is not support by device. on line 1668
code:
if (contactSensor) ind = (contactSensor.currentValue("contact").contains('closed') ? 1 : 0);
else ind = -1
log:
app:16 2018-03-06 13:09:55.696:errorCommand ācurrentValueā is not support by device. on line 1668
Any reason why contactSensor.currentContact == 'closed'
canāt be used?
no particular reason but this seems to work:
if (motionSensors) ind = (motionSensors.currentValue("motion").contains('active') ? 1 : 0);
any reason the same style would not work for contact sensor?
Gotcha. I thought for a second that might be working since it seems to be a map of multiple motion sensors, but after testing it quickly it still doesnāt work. Iād just go with what works for now since thereās no official documentation. currentValue() and current[attribute name] seem to have the same functionality.
Iāll test this tomorrow, as it makes no sense why this doesnt workā¦
In this instance, contactSensor is multiple:true?, or falseā¦
thanks. multiple:true
they do have the same functionality. but i use currentValue(āattributeā) all over the place and too lazy to write a regex to replace everything
were you able to confirm why this one fails and when a fix would be available?
thanks.
its failing with every occurrence so cant get the app to work.
code:
log:
app:16 2018-03-08 18:37:27.610:errorCommand 'currentValue' is not support by device. on line 2411
This only fails against an input where multiple is true, which is a list, has nothing to do with the attribute name. For now just use an iterator.
thanks. yes had figured out that part already.
i am trying to keep the codebase the same for ST and hubitat. any word on when there will be a fix?
thanks.
Please submit an issue to support on this, weāll then get it into our issues list.
For the time being you can use an iteration (find, findAll, each, collect ect), this will also work on your other platformā¦
Hereās a little javascript to regex it. Itāll convert .currentValue("contact")
to .currentContact
or any other attribute. I havenāt tested if current[Attribute] works on a map though.
I just did a quick test and it works on a map. I know it doesnāt solve the currentValue bug but might be an easier transition until a fix is in place. Run it through the regex and copy the updated code to Hubitat. Or Mikeās suggestion is probably better to make a change thatāll work on both platforms.
didnt get this part
whether its sensor.currentValue(ācontactā) or sensor.currentContact both are going to fail when sensor is multiple unless i use an iterator.
Hm, I might be missing something. It should work in the context of your first post:
if (contactSensor) ind = (contactSensor.currentContact.contains('closed') ? 1 : 0);
else ind = -1
I tested this section and had no errors and returned true/false correctly. Is there another context where it wonāt work?
thought it didnt work without an iterator when contact sensors specified is multiple?
Worked for me testing with switches:
2018-03-08 21:57:44.864:debug switches.currentSwitch.contains('on'): false
2018-03-08 21:57:44.863:debug switches.currentSwitch.contains('off'): true
2018-03-08 21:57:44.861:debug switches.currentSwitch: [off, off]
2018-03-08 21:57:44.855:debug switches: [Backyard Light, Office Lamp]
ahh ⦠ok. wasnt expecting that based on that post. will check with contact sensors. if it works ⦠i use atom for github personal stuff so these should work for me:
search: (\.currentValue\(")([a-z])(.+)("\))
replace: .current\U$2\L$3
will give it a try after i have confirmed.
thanks again.