#iOS Companion App Activity Sensor always undefined

1 messages · Page 1 of 1 (latest)

desert tartan
#

Hi all, I wanted to create an automation to check weather the activity is automotive or stationary to trigger certain things in HA.
When I check within the DevTools I see the state to be Stationary or Automotive according to if I am in the car or at home. When using a template in devtools to check the state_attr type or confidence and use it in an automation I always get the message 'sensor is undefined'.
Any ideas?

desert tartan
#

Well I thought this is a support channel. But obviously nobody is answering my questions here… did I do something wrong?

bitter belfry
#

Not sure if this is related to companion app or some failure in your template instead? Maybe try pasting your template to start with...

modest basin
#

I wouldn’t rely on this sensor, since the app can’t guarantee it will update sensors in realtime you may miss events

#

If you use CarPlay you can check if it’s connected through the audio output sensor

desert tartan
#

It does not matter what kind of Template I use. Once I try to use it is returns always unknown/undefined sensor in the dev tools. The question is more how to use them instead of what am I doing wrong? I was not able to find proper information in the documentation. There are only the sensor names mentioned. I would expect I can call them by {{ sensor.deviceName_audio_output }}
But this returns ‚sensor‘ is undefined

#

Or for the Activity sensor by using the state_attr(sensor.deviceName_activity, ‚attribute name‘)

bitter belfry
#

states('sensor.your_sensor')

ocean talon
#

I would instead use a virtual button that you can then add to HomeKit, and then automate off the state of that switch

Reason being, it’d be a WHOLE lot more reliable, simpler, and easier, if you did that and then just wrote a couple automations in the shortcuts app that say “When I connect to CarPlay, turn On my Automotive Switch” and “When I disconnect from CarPlay, turn Off my Automotive Switch”

From there you can use the state of that switch to trigger whatever automations you want, or as a condition for controlling automation flow

I myself was using Homebridge for a good while before setting up Home Assistant, so I have a nifty little plugin in there for creating virtual accessories, then the I have that connected to Home Assistant now, which then uses a HomeKit Bridge integration to pipe them back out again to HomeKit

Though it is also much simpler/straight forward to create a virtual switch right in Home Assistant with a helper, which you could then probably pipe to HomeKit through a HomeKit Bridge, I just can’t verify that’d work the same as I’ve personally always had this Homebridge setup so I’ve never tried it myself. Don’t see why exporting Home Assistant helpers would be any different though… so if you don’t already have Homebridge worked into your ecosystem, then I’d start there, with a simple Home Assistant ‘Switch’ Helper

Also, if you don’t have CarPlay, I’d imagine you still have some sort of wireless setup for audio in your care, and you can sub out CarPlay connection events for Bluetooth connection events with any specific given device, like your car stereo, and should work just the same.