Okay #homeAssistant fans.
I'm trying to make a sensor entity that is effectively a binary sensor (I'm defining it as such), with its creation dependent on data from an integration I'm building.
The issue:
The integration's coordinator.py I've written polls an IoT device for data, and BASED ON THAT DATA filters it to check for a real piece of connected hardware (an inverter attached to a charging station) or a fake one. (We have the fake data strings we know to filter out).
This leaves us with a real_inverter flag that's either true or false, and that allows my sensor.py to create (or skip) sensor entity creation based on that real_inverter flag (I actually call it something else in the code, but this is a good stand in).
In my sensor.py, this works PERFECTLY. If there's not a real inverter attached, the integration doesn't create sensor entities relating to the Inverter. And the coordinator and the sensor work together to make sure everything is properly cleaned before deciding what to create in the ~60 second initial integration startup.
BUT.
In Binary_sensor.py? It's not playing ball. Despite trying the same logic I used in sensor.py, it either
i) Creates a binary sensor for "power cut" for stations, regardless of if they have a real inverter or not
OR
ii) Doesn't create anything and says it doesn't see a real inverter attached... all while Sensor.py is working as it should.
Is it just me, or are binary_sensors in #HA just a PITA? I'm contemplating moving the creation and operation of my (formerly) binary_sensor for power cuts to sensor.py and just ... working from that.
What would you do?