I plan on publishing my config to github once I get a little more added to it.
The person buttons at the top do not refer to presence, but used to notify the specific user when the washer/dryer has finished. I work irregular hours and would prefer to not cast/notify all devices if someone else is doing laundry.
as for the time, its a run time, showing how long the washer/dryer has run on the last cycle.
@RomRider I was playing around with my remote activity buttons a little more today. What I think is happening now, is that after performing the tap_action, the javascript objects are not being refreshed. Was that the bug you were mentioning before? I’ve been debugging via logging to the console and after switching activity, the hass, states, and entity objects don’t change based on the state changing.
So what I thought was the javascript templates in the config template being evaluated and put in as static values, I think was incorrect. It was just really that it’s not picking up the state changes.
Here is a zip file with a simple test case, basically just a small portion of my remote. You should be able to just change the harmony hub name and the activities to test it out.
Anyone using this in a horizontal-stack with swiper card? I have tried it in the past but I have issues with touch being too sensitive.
The cards work fine (have them setup in a horiontal-stack), but when swiping to the next set of button cards in a horizontal-stack, I have to start the swipe motion by dragging a button card. It then either registers it as a tap_action or hold_action (depends on how slow I drag). Is there a way I can fix this by either doing something to button card or swiper card? I asked in the swiper card topic but unfortunately no succes, so figured try it here too.
This behaviour is om iOS and Android btw. On desktop with a mouse it seems to work fine.
@RomRider, could you tell me how the card knows when to refresh itself?
I’m asking because I wanted to create a card that shows states of 2 sensors and I couldn’t find in the docs anything that answers my question so I wasn’t sure it will update itself when state of each sensors changes.
I ended up creating a card with no entity and a name that is a template like this (this one uses only one sensor but the idea is the same across the board)
and it seems to be updated well.
So my question is - what rules do we need to follow (if any) to make sure out cards are updated when data its field are based upon is changed?
Cheers
If there is a template defined ([[[...]]]), it will update anytime any entity is updated even without the entity field defined.
If there is only an entity defined, it will update only if this entity is updated.
Thanks for confirming.
Is HA or your card evaluates templates?
If it’s HA, things like
{% set entity = 'sensor.test' %}
{{ return states(entity) }}
won’t trigger update if the template as HA fails to detect entity to listen to.
(I know this card uses JS templates but I just used Jinja to show you what I mean.)
If it’s your card that is in charge of evaluating templates, I take it there is no requirements to follow to get them updated.
The card computes everything in frontend, not HA. For every card in lovelace, an update is requested when the hass object is assigned (it contains all the states, so as soon as any state is updated, it should be reassigned to each card). When that variable is assigned, I check if the button needs an update or not based on the rule above (Lovelace: Button card)
But if HA does not assign the hass object, the card will not be updated and this is out of my control.
Thanks for the great explanation!
Actually, after reading the rule for the second time I realised that in case when there is no entity specified, the card will be updated every time any HA entity changes its state (or an attribute).
It sounds a bit overkill so maybe you could add a config variable like entities that will hold all entities that can trigger update of the card so we would dramatically reduce the number of required updates?
If it sounds ok, I’ll create a FR and add more details to it there.
I thought about this a while ago but you’d need to list all the entities in your templates and cards in custom fields (and I know some people have a lot ). Also I didn’t want to handle questions like “why is my card not updating?” as this would be an advanced feature and I don’t plan to do auto discovery at all
Don’t bother with the PR, I’ll handle it later today or tomorrow
(I’ve got a bunch of bugfix already on their way and a lot of modifications in the way I build the card also on its way so not a great time to do a PR)
Hmm, interesting. If I have a button-card that has no entity defined, and it has a custom field that is a vertical-stack that contains several horizontal-stacks each of which has several button-cards, would each of those button-cards follow the same principles on getting updated? In other words are they completely independent from any enclosing button-card that might house them?
And does HA see those “sub-cards” as independent cards meaning that it also attempts to reassign the hass object to them upon a state change?
I can’t imagine why and how to make them dependent tbh. They shouldn’t be.
well, imho HA has nothing to do with the cards in general, all that happens is hass object changes when anything in HA changes and all cards get an updated hass.
The reason I was asking is because I was commenting in an earlier post that I’m seeing a case where it doesn’t appear the hass object is being updated, even upon a state change if I have an entity defined, or even if I have no entity defined. The card in question is buried in
well, you need to tell that. and even if your observation is right,
have you tried “digging” your card out to see if it makes any difference?
I mean, you can leave the weird one where it is and create an identical one at say, top level and compare their behaviour if you suspect it has something to do with nesting.
Sorry, I said it in around post 3287 last night about the hass object not getting updated. That’s why when @RomRider mentioned how the updates happen, it peaked my interest.
Definitely a good idea about trying to create a top level card that’s the same as the buried one. I’ll try that out, thanks!