What causes the switch integration to change an entity ID?

Hi. I have one specific z wave switch which is causing me problems in Home Assistant and it’s driving me nuts.

The switch itself is handled by ZWaveJS2MQTT and works fine - if I go in to the device/entities section the device is available and works correctly. What doesn’t work correctly is that I have the switch presented as a light which is itself then used in automations and dashboards:

  • platform: switch
    name: Barn security light
    entity_id: switch.in_wall_dual_relay_switch_module_2x1_5kw_with_power_meter

For some reason this config works fine after a fresh restart of home assistant, but at a random point later the switch integration will stop providing it, then reprovide it with a _2 on the end of the entity name, so my ‘light.barn_security_light’ will turn in to ‘light.barn_security_light_2’, which obviously breaks the dashboards and automations. The underlying entity name (in_wall…etc) remains the same.

The actual light itself is fine, and I have another light which is exactly the same (Fibaro ZWave module presented to HA via ZWaveJS2MQTT) and that behaves as expected.

Can anyone tell me what’s going on or how to diagnose it, please? Thankyou!