simonbs, (edited )
@simonbs@mastodon.social avatar

Trying to get Home automation to check the power state of a lamp and send a notification if it's on. "Get Desk Power State" outputs "Yes" when running the action through Shortcuts and testing the automation in the Home app but the action outputs "No" when the automation is run in the background at a time of day. Does anyone know why that is and know of a workaround?

matthewcassinelli,
@matthewcassinelli@mastodon.social avatar

@simonbs Put the “Nothing” action in the Otherwise area, the If action is returning the “No”/Off state as the true/false/boolean state

simonbs,
@simonbs@mastodon.social avatar

@matthewcassinelli Right but it's not as much the output of the shortcut that's the problem but the output of the "Get Desk Power State" action. Running the shortcut as a Home Automation causes it to take the wrong branch of the if-statement.

matthewcassinelli,
@matthewcassinelli@mastodon.social avatar

@simonbs Ah my mistake, I misunderstood. Assuming it’s all on/in the same state, I wouldn’t know then. Possibly what Aaron said but the Home Hub runs these and it should work regardless.

aaron_pearce,
@aaron_pearce@mastodon.social avatar

@simonbs generally apps can’t access HomeKit data in the background so it could be that. When you read in the background, it returns the last value seen by a foregrounded app on the device.

Jochel,
@Jochel@mas.to avatar

@simonbs Try to remove the "get" block and receive the state of your lamp directly in the condition field of the "if" block. That’s how I do it in my home automations and it usually works.

simonbs,
@simonbs@mastodon.social avatar

@Jochel Receiving the state from within the if-statement seems to do the trick. Thanks for the tip!

mlinzner,
@mlinzner@mastodon.nl avatar

@simonbs what is your home hub? If it’s an iPad have you tried running it there? I believe automations are running on the hubs and not the devices we would usually test them on.

mlinzner,
@mlinzner@mastodon.nl avatar

@simonbs obviously this only applies if you set it up as Home Automation and not as Personal Automation.

simonbs,
@simonbs@mastodon.social avatar

@mlinzner I have two Apple TVs, a HomePod , a HomePod mini, and a Philips Hue Bridge. I'm using Home Automation.

akamatchstic,
@akamatchstic@mastodon.online avatar

@simonbs I’ve had stuff like this happen when the device is trying to reconnect to network after waking for the automation. Might be worth popping in a wait at the start of the shortcut, about 5s or so

simonbs,
@simonbs@mastodon.social avatar

@akamatchstic I like the idea but unfortunately it didn’t do the trick. I tried with both five and ten seconds.

simonbs,
@simonbs@mastodon.social avatar

This is the kind of thing that makes me lose trust in Home and Shortcuts apps, and I have no way of knowing if:

  1. This is working as intended but the “Get state of Home” action isn’t allowed to read some attributes when running in the background for whatever reason.
  2. It’s one of Shortcuts’ million bugs.
  3. I’m holding it wrong.
simonbs,
@simonbs@mastodon.social avatar

So, the automation seems to work if I run it as a Personal Automation in the Shortcuts app rather than as a Home Automation in the Home app 🤷‍♂️

aaron_pearce,
@aaron_pearce@mastodon.social avatar

@simonbs that sounds like Apple Home as usual. Unsure how this app/feature ships sometimes.

simonbs,
@simonbs@mastodon.social avatar

@aaron_pearce Yeah, it’s really a mess. Apparently, the Home Automation works too if I receive the state of the lamp within the if-statement rather than in a separate action from the Home app 🫨

aaron_pearce,
@aaron_pearce@mastodon.social avatar

@simonbs of course. Sounds about right for the app. 😂

simonbs,
@simonbs@mastodon.social avatar

Receiving the power state from within the if-statement instead of using a separate action from the Home app also seems to work even when using a Home Automation. It's a mess, but I'm happy it seems to work.

Now that the automation works with a lamp and a time of day, I suppose it will also work to read the state of a contact sensor from an automation running when I leave the home.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • Durango
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • GTA5RPClips
  • cubers
  • ethstaker
  • normalnudes
  • tacticalgear
  • cisconetworking
  • tester
  • Leos
  • modclub
  • megavids
  • provamag3
  • anitta
  • lostlight
  • All magazines