[APP][Pro] Home Assistant - Community App

Indeed, the presence_state capability of my presence device is a string type

Hiya,
I use my Philips Hue via my Home Assistant. Within my Philips Hue I have multiple motion sensors. This all works as expected! Although sometimes I don’t want the lights to turn on when motion is detected. In that case I use the build in Device Switches to turn off the motion sensor, so no motion can be detected. These device switches can be turned on and off withing the Homey Flows, but I can’t find a way to use them in the when part of the flow. So, for example, when the Device Switch is turned off, change a variable. Am I missing something or is this not possible?

Thanks in advance!

Did you add them as a switch?

Works here…

If you add the switch entity as switch device, you get the on/off trigger like shown in JB2Ks screenshot.

If the capability was added later (device settings or repair view), then you can use the generic “capability changed” trigger. Dependent on the data type of your capability you can use one of the tags to check the state with a logic card. For a switch you can use the boolean (yes/no) tag.

Since I added the device switches via the settings of the motion sensor I tried the flow card you suggested. What I notice is that the flow triggers when I change the switch within HA. But, when I manually change the switch in Homey, the flow doesn’t trigger. Is this a bug or expected behavior?

Does the switch reflect in HA?

If you switch the switch in homey from off to on does it also
Go from off to on In HA?

Yep it does! If I change the switch manually within Homey it is also changed in Home Assistant. And the other way around works as well. So if I change the switch in Home Assistant it is also changed in Homey.

I have to check this with some test devices. I hope to have time for it next week.

If there is anything I can test, don’t hesitate to ask :slight_smile:

Sorry for the delay…just a short state comment.

When pressing a switch control from Homey, the capability already changes, then the command is sent to HA.
When the entity state change is synced back, the new state (from HA) is the same as the capability (already changed before).
…just a a technical background for the state sync process.

So I have to trigger the flow already on switch press in Homey app.
I’ll add this soon.

New test version 1.5.4:

  • Added trigger for state change of switch entities (added vie device settings or repain view) on button press in Homey

@daniel3: You can install the test version now and try if the trigger works now from Homey device, too.

1 Like

It seems to be working now! Thanks for the quick fix :smiley:

1 Like

Hey, is there something wrong with this when card for tracker device or I’m missing something? For ‘Value of capability [[capability]] changed’ card capabilities list is empty for me, however card ‘Value (text) capability [[capability]] is [[text]]’ shows proper capabilities. Attaching a screenshot, I’m assuming that both cards should have ‘presence_state’ capability. I’v checked this card on latests stable and test versions. Any help much appreciated.

Hi,
it seems yoiu added the prersence entity as presence device?
In this case you can use the standard triggers for the alarm capability.

grafik

Then you can react on the alarm capability.

The state capability you used represents the entity state from HA as a string/text (“home”, “away”,…).
If you want to check this capability, you can use the “Value (text) of…” card and then compare to the possible states of your HA entity with a logic card.

The difference between the two card you tried is:

  • 1st card only allows to select capabilities added from device settings or via repair view
  • 2nd card allows to select main device capabilities added automatically during pairing (you can’t change them in repair view)

So far the explainations…Anyway thanks for the hint. I’ll extend the first card to check all capabilitites of a device in the next version.

Edit:
As I saw now, the text/numeric trigger are defined only for sensor devices and its automatically added capability for the entity state.
For all other devices, the “capabilit changed” trigger is right. So I’ll add all capabilities to the autocomplete list.
The conditions (like “text/number is…” are present for all devices.

New test versions 1.5.5 and 1.5.6 are just for adding and removing a test implementation:

  • changed generic ‘capability changed’ trigger autocomplete list.

@Bart_Si
Sorry, the trigger can’t be changed. It’s meant for trigger flows based on generic capabilities added via settings or repair view. So the autocomplete list will only show these capabilitites.

For fixed device capabilities, the are associated triggers you should used:

For the alarm:
grafik

And for the entity state:
grafik

Thank’s for swift response @RonnyW, your explanation makes sense. I was trying to use that card as a trigger as, I understand, it could provide me both previous and current state but I can easily handle my flow with Presence alarm or Presence state card.

Triggers are executed after a capability change. The new value is provides as tag (for the generic trigger 3 tags where one is filled based on the type). So you can also use conditiln cards or logic cards to check the current (new) capability value.

The old value is not available in this case. But a nice idea. For the generic trigger I could perhaps add tags for the ‘old’ values, because this trigger is executed from the device and not from standard Homey code :grinning:

1 Like

I have made a Custom motion sensor from HA, works fine of course, but it does not trigger Zone Activity, maybe that could be implemented in the next version? You can choose what devices who should be included in Zone Activity, but the HA app does not appear there. Thx again for a super app!!

Did you add the entity to a custom device? Please try to add the entity as main capability (activate the checkbox in add entity view). I think the zone activity only recognizes main capabilities like “alarm_motion”, not subcababilities.

New test version 1.5.7:

  • Added old entity value tags to ‘Value of capability changedflow card.

As a small addition, the old capabiliy values are available now in the “capability changed” trigger card.

grafik

3 Likes