Use one line if it exists, but another if it doesn't

Hi, looking for some help to pull this off. I currently use a line of code that HA pulls from a sensor from the HA Android app to perform an action, but I noticed at times that line doesn’t really have what I want but another line does, but that new line only exists when it actually has what I want vs the other line, so basically I want to reference that Line B, but only if it exists. If it doesn’t exist, I want to reference Line A instead. How would I manage this? Thanks.

Hi Iceman24,

Thanks for the question. Unfortunately the question likely sounds better in your head that it does to us because we nave no context whatsoever.

Please provide some code formatted the right way so we can see what you see and possibly help you.

How to help us help you - or How to ask a good question.

2 Likes