Switch and Presence Status in User App

Migrating an existing ST app to Hubitat. Having a little problem with device status.

Trying to detect presence and switch status. I can subscribe to capability.presenceSensor and that works. When I try to look at the value in the code I am using person.presence, but that returns null.

On a switch I am using someswitch.switch which also returns null. I also tried someswitch.currentSwitch. No luck.

These are obviously different than ST, but I can't find what they should be.

I'm no good with code so cannot help with your query but can I ask if you are trying to code a presence sensor with switch?
If so, there is a driver type already existing for this.

Can you post the part of the code you are working with. It would give us a better idea.

Example if you are looking at the handler method then evtObject.value will get you want you want. If you are working with the device then deviceObject.currentValue(attribute) should get you what you want.

1 Like

Figured it out. It's switch.currentswitch and person.currentpresence.

No I was looking at a presence sensor. The switch was a different device. Just both used in the same app.

1 Like