I set the visibility via the card options and save it. Works as expected. Now I go back to edit the card and the “visibility” code is gone, it just gets deleted by HA. I am assuming this happens on edit, as the function works as long as I don’t edit the card.
Activating a visibility option again works fine and the code is added to my yaml. On the next edit, it is gone again.
This is a long code, 600 lines.
And it includes card-mod.
Can you test with card-mod with a SHORTER easy reproducible code and then post this code here.
There is a known issue that card-mod code is deleted - but nothing about a visibility code.
Close it and reopen it and the “visibility” code is gone. At least for me. Simple cards do not have this problem. There was CARD_MOD code, I removed it.