Repository: home-assistant/core (Python)

Issue:
Rainbird: Entity no longer being provided by the rainbird integration
### The problem

After upgrade to 2023.10.0 rainbird entities are no longer available and all of the entities are in "no longer being provided by the rainbird integration" state. No errors in the log. Attached is the debug log.

### What version of Home Assistant Core has the issue?

core-2023.10.0

### What was the last working version of Home Assistant Core?

core-2023.9.3

### What type of installation are you running?

Home Assistant Container

### Integration causing the issue

Rainbird

### Link to integration documentation on our website

https://www.home-assistant.io/integrations/rainbird/

### Diagnostics information

There is no option to download diagnostic data for rainbird integration.

### Example YAML snippet

```yaml
N/A
```


### Anything in the logs that might be useful for us?

```txt
2023-10-05 14:24:29.978 DEBUG (MainThread) [pyrainbird.async_client] Request (ModelAndVersionRequest): 02
2023-10-05 14:24:29.978 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696508669.9787104, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "02", "length": 1}}
2023-10-05 14:24:31.153 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":5, "data":"8200060100"}, "id": 0}
2023-10-05 14:24:31.153 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8200060100
2023-10-05 14:24:31.153 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'ModelAndVersionResponse', 'modelID': 6, 'protocolRevisionMajor': 1, 'protocolRevisionMinor': 0}
2023-10-05 14:24:31.153 DEBUG (MainThread) [pyrainbird.async_client] Request (AvailableStationsRequest): 0300
2023-10-05 14:24:31.153 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696508671.1536999, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "0300", "length": 2}}
2023-10-05 14:24:31.814 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"8300FF000000"}, "id": 0}
2023-10-05 14:24:31.814 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8300FF000000
2023-10-05 14:24:31.814 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'AvailableStationsResponse', 'pageNumber': 0, 'setStations': 4278190080}
2023-10-05 14:24:31.814 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentStationsActiveRequest): 3F00
2023-10-05 14:24:31.814 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696508671.8145082, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3F00", "length": 2}}
2023-10-05 14:24:32.204 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"BF0000000000"}, "id": 0}
2023-10-05 14:24:32.204 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BF0000000000
2023-10-05 14:24:32.204 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentStationsActiveResponse', 'pageNumber': 0, 'activeStations': 0}
2023-10-05 14:24:32.204 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentRainSensorStateRequest): 3E
2023-10-05 14:24:32.204 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696508672.204303, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3E", "length": 1}}
2023-10-05 14:24:32.599 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":2, "data":"BE00"}, "id": 0}
2023-10-05 14:24:32.599 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BE00
2023-10-05 14:24:32.599 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentRainSensorStateResponse', 'sensorState': 0}
2023-10-05 14:24:32.599 DEBUG (MainThread) [pyrainbird.async_client] Request (RainDelayGetRequest): 36
2023-10-05 14:24:32.599 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696508672.5997853, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "36", "length": 1}}
2023-10-05 14:24:33.049 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":3, "data":"B60000"}, "id": 0}
2023-10-05 14:24:33.049 DEBUG (MainThread) [pyrainbird.async_client] Response from line: B60000
2023-10-05 14:24:33.049 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'RainDelaySettingResponse', 'delaySetting': 0}
```


### Additional information

Works ok again after downgrading HA to 2023.9.3


Discussion: 
Hey there @konikvranik, @allenporter, mind taking a look at this issue as it has been labeled with an integration (`rainbird`) you are listed as a [code owner](https://github.com/home-assistant/core/blob/dev/CODEOWNERS#L1019) for? Thanks!

<details>
<summary>Code owner commands</summary>


Code owners of `rainbird` can trigger bot actions by commenting:

- `@home-assistant close` Closes the issue.
- `@home-assistant rename Awesome new title` Renames the issue.
- `@home-assistant reopen` Reopen the issue.
- `@home-assistant unassign rainbird` Removes the current integration label and assignees on the issue, add the integration domain after the command.

</details>


<sub><sup>(message by CodeOwnersMention)</sup></sub>

---

[rainbird documentation](https://www.home-assistant.io/integrations/rainbird)
[rainbird source](https://github.com/home-assistant/core/tree/dev/homeassistant/components/rainbird)
<sub><sup>(message by IssueLinks)</sup></sub>
Hi @adorobis appreciate filing the separate broken out issue.

Can you help me by finding a little more detail in the logs from rainbird? This subset shows Rainbird requests to the device that appear to be working fine. Perhaps with debug mode on reloading the integration may give us a little more insight to what is happening at integration start that is not registering the entities.
The main change in this release is related to the devices with no serial number and assignment of unique ids. 
https://github.com/home-assistant/core/pull/101168 though the intent is to preserve things for existing configurations.
I have the same issue (also after upgrading to 2023.10.0 from 2023.9.3)
![image](https://github.com/home-assistant/core/assets/115901851/b45928f1-7faa-4fd8-a7d5-8a2d2d918427)

> Hi @adorobis appreciate filing the separate broken out issue.
> 
> Can you help me by finding a little more detail in the logs from rainbird? This subset shows Rainbird requests to the device that appear to be working fine. Perhaps with debug mode on reloading the integration may give us a little more insight to what is happening at integration start that is not registering the entities.

Here it is with debug logging and reload of the integration. More or less the same as in the previous ones. Seems it is getting data correctly from rainbird controller but somewhere in HA it is lost. Btw, this is example from a different instance running 2023.10.0 where the rainbird integration was not existing before. Entities were not created at all.

```
2023-10-05 17:52:41.139 DEBUG (MainThread) [pyrainbird.async_client] Request (ModelAndVersionRequest): 02
2023-10-05 17:52:41.139 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521161.139403, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "02", "length": 1}}
2023-10-05 17:52:41.486 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":5, "data":"8200060100"}, "id": 0}
2023-10-05 17:52:41.486 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8200060100
2023-10-05 17:52:41.486 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'ModelAndVersionResponse', 'modelID': 6, 'protocolRevisionMajor': 1, 'protocolRevisionMinor': 0}
2023-10-05 17:52:41.486 DEBUG (MainThread) [pyrainbird.async_client] Request (AvailableStationsRequest): 0300
2023-10-05 17:52:41.486 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521161.486918, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "0300", "length": 2}}
2023-10-05 17:52:41.840 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"8300FF000000"}, "id": 0}
2023-10-05 17:52:41.840 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8300FF000000
2023-10-05 17:52:41.840 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'AvailableStationsResponse', 'pageNumber': 0, 'setStations': 4278190080}
2023-10-05 17:52:41.841 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentStationsActiveRequest): 3F00
2023-10-05 17:52:41.841 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521161.841271, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3F00", "length": 2}}
2023-10-05 17:52:42.194 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"BF0000000000"}, "id": 0}
2023-10-05 17:52:42.194 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BF0000000000
2023-10-05 17:52:42.194 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentStationsActiveResponse', 'pageNumber': 0, 'activeStations': 0}
2023-10-05 17:52:42.195 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentRainSensorStateRequest): 3E
2023-10-05 17:52:42.195 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521162.195211, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3E", "length": 1}}
2023-10-05 17:52:42.531 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":2, "data":"BE00"}, "id": 0}
2023-10-05 17:52:42.531 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BE00
2023-10-05 17:52:42.531 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentRainSensorStateResponse', 'sensorState': 0}
2023-10-05 17:52:42.532 DEBUG (MainThread) [pyrainbird.async_client] Request (RainDelayGetRequest): 36
2023-10-05 17:52:42.532 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521162.532154, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "36", "length": 1}}
2023-10-05 17:52:42.880 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":3, "data":"B60000"}, "id": 0}
2023-10-05 17:52:42.881 DEBUG (MainThread) [pyrainbird.async_client] Response from line: B60000
2023-10-05 17:52:42.881 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'RainDelaySettingResponse', 'delaySetting': 0}
2023-10-05 17:52:42.881 DEBUG (MainThread) [homeassistant.components.rainbird.coordinator] Finished fetching 10.144.1.121 data in 1.395 seconds (success: True)
```
And here on an instance where rainbird was there on 2023.9.3 and upgraded to 2023.10.0:
```
2023-10-05 18:03:07.747 DEBUG (MainThread) [pyrainbird.async_client] Request (ModelAndVersionRequest): 02
2023-10-05 18:03:07.747 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521787.7475102, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "02", "length": 1}}
2023-10-05 18:03:08.098 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":5, "data":"8200060100"}, "id": 0}
2023-10-05 18:03:08.098 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8200060100
2023-10-05 18:03:08.098 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'ModelAndVersionResponse', 'modelID': 6, 'protocolRevisionMajor': 1, 'protocolRevisionMinor': 0}
2023-10-05 18:03:08.099 DEBUG (MainThread) [pyrainbird.async_client] Request (AvailableStationsRequest): 0300
2023-10-05 18:03:08.099 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521788.0994291, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "0300", "length": 2}}
2023-10-05 18:03:08.499 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"8300FF000000"}, "id": 0}
2023-10-05 18:03:08.499 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8300FF000000
2023-10-05 18:03:08.499 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'AvailableStationsResponse', 'pageNumber': 0, 'setStations': 4278190080}
2023-10-05 18:03:08.499 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentStationsActiveRequest): 3F00
2023-10-05 18:03:08.499 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521788.4995015, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3F00", "length": 2}}
2023-10-05 18:03:08.843 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"BF0000000000"}, "id": 0}
2023-10-05 18:03:08.843 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BF0000000000
2023-10-05 18:03:08.843 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentStationsActiveResponse', 'pageNumber': 0, 'activeStations': 0}
2023-10-05 18:03:08.843 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentRainSensorStateRequest): 3E
2023-10-05 18:03:08.843 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521788.843746, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3E", "length": 1}}
2023-10-05 18:03:09.179 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":2, "data":"BE00"}, "id": 0}
2023-10-05 18:03:09.179 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BE00
2023-10-05 18:03:09.179 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentRainSensorStateResponse', 'sensorState': 0}
2023-10-05 18:03:09.179 DEBUG (MainThread) [pyrainbird.async_client] Request (RainDelayGetRequest): 36
2023-10-05 18:03:09.179 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696521789.1798565, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "36", "length": 1}}
2023-10-05 18:03:09.533 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":3, "data":"B60000"}, "id": 0}
2023-10-05 18:03:09.534 DEBUG (MainThread) [pyrainbird.async_client] Response from line: B60000
2023-10-05 18:03:09.534 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'RainDelaySettingResponse', 'delaySetting': 0}
2023-10-05 18:03:09.534 DEBUG (MainThread) [homeassistant.components.rainbird.coordinator] Finished fetching 10.144.1.121 data in 1.435 seconds (success: True)
```
Very odd.

In #101489 the user reports that the entities are disabled. Perhaps you can look for that? Do any of the entities appear in developer tools?


In my instance when running with logging turned up i see these:

```
2023-10-05 20:25:41.027 INFO (MainThread) [homeassistant.setup] Setting up rainbird
2023-10-05 20:25:41.027 INFO (MainThread) [homeassistant.setup] Setup of domain rainbird took 0.0 seconds
...
2023-10-05 20:25:48.594 INFO (MainThread) [homeassistant.components.switch] Setting up switch.rainbird
2023-10-05 20:25:48.615 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rainbird
2023-10-05 20:25:48.618 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.rainbird
2023-10-05 20:25:48.619 INFO (MainThread) [homeassistant.components.number] Setting up number.rainbird
2023-10-05 20:25:48.620 INFO (MainThread) [homeassistant.components.calendar] Setting up calendar.rainbird
```

Do any of those show up earlier in the log? I suspect the calendar one will not because that device has no programs.
For me, after upgrade and fixing the pydantic issue, rainbird didn't reconnect to existing entities. So I tried to remove the reinbird integration and setup it again, but now it doesn't detect any of sprinklers neither sensor and I guess neither controller. I thing it should be also separate entity under the integration: 
![image](https://github.com/home-assistant/core/assets/10024874/17ac9b40-c746-4a30-92ff-6bdc404fb099)

@konikvranik Does it show up if you search for any of the entities  from `Devices & Services > Entities`?  I am wondering if there are entities but they are not linked into the integration or disabled.

@allenporter: You're right. There are new entities not connected to the integration and saying the it has not unique ID:
![image](https://github.com/home-assistant/core/assets/10024874/face6595-ff99-43bd-95b7-8ad11d08bce2)

OK thank you -- This was not intentional and I have #101470 to fix.  The problem is the devices have a "0" serial number which is not a valid unique id, but I'll send a fix to keep ti working for the existing entities for folks that already have it setup.
@allenporter Great, thanks! Let us know when we could test it, I have additional HA instances for testing purposes.
> OK thank you -- This was not intentional and I have #101470 to fix. The problem is the devices have a "0" serial number which is not a valid unique id, but I'll send a fix to keep ti working for the existing entities for folks that already have it setup.

Many thanks Allen,

In addition, for the time being, the new entities which are not linked to the integration are nevertheless working (eg: switch.rain_bird_sprinkler_1) but they have no unique Id, so I cannot manage them in the UI to match the old_name before updating so that my configuration still works)
Anyway I can make this work ?

Great integration otherwise, save my day ;-)
> Anyway I can make this work ?

I have just reverted to 2023.9.3 while waiting for the fix to come :) Super easy if you are on a Docker installation.
Also super easy in regular HA, as the update that broke it creates a backup before, you can just revert to that, skip the impending update and wait for the fix. Thats what i am doing as well. Thanks for the fast response and fix. My issue is the exact same as @adorobis, not the cython/python issue that was mentioned.
I wasn't capable of reverting to working HA, even by completely removing the venv and recreating a new one with 2023.9.3. Pydantic was failing there again regardless of whether it was 1.10.12 or 1.10.13 or 1.10.11. The only possible fix is to enforce pydantic 2.4.* which fixes the crucible integrations, but at least disables Google calls integration.
> I wasn't capable of reverting to working HA, even by completely removing the venv and recreating a new one with 2023.9.3. Pydantic was failing there again regardless of whether it was 1.10.12 or 1.10.13 or 1.10.11. The only possible fix is to enforce pydantic 2.4.* which fixes the crucible integrations, but at least disables Google calls integration.

As far as i understand. these are different issues
I was just replying to your comment regarding rollback.
@allenporter 
I've just applied the changes from this PR to my test environment, it did not fix the existing integration. I've deleted it and added again and there are no entities linked to the integration:
![image](https://github.com/home-assistant/core/assets/19752098/1f7c0c05-1363-4c33-804f-9bb588bbf00e)
But they are created and now working ok:
![image](https://github.com/home-assistant/core/assets/19752098/5c33ab58-d105-4126-8fe0-7d5c579f7364)
![image](https://github.com/home-assistant/core/assets/19752098/45605867-9e49-49cb-ab80-b55e5224950b)
And here is the debug log:
```
2023-10-06 10:06:21.724 DEBUG (MainThread) [pyrainbird.async_client] Request (ModelAndVersionRequest): 02
2023-10-06 10:06:21.724 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696579581.7246547, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "02", "length": 1}}
2023-10-06 10:06:22.095 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":5, "data":"8200060100"}, "id": 0}
2023-10-06 10:06:22.095 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8200060100
2023-10-06 10:06:22.095 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'ModelAndVersionResponse', 'modelID': 6, 'protocolRevisionMajor': 1, 'protocolRevisionMinor': 0}
2023-10-06 10:06:22.096 DEBUG (MainThread) [pyrainbird.async_client] Request (AvailableStationsRequest): 0300
2023-10-06 10:06:22.096 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696579582.0961888, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "0300", "length": 2}}
2023-10-06 10:06:22.453 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"8300FF000000"}, "id": 0}
2023-10-06 10:06:22.453 DEBUG (MainThread) [pyrainbird.async_client] Response from line: 8300FF000000
2023-10-06 10:06:22.453 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'AvailableStationsResponse', 'pageNumber': 0, 'setStations': 4278190080}
2023-10-06 10:06:22.454 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentStationsActiveRequest): 3F00
2023-10-06 10:06:22.454 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696579582.4542468, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3F00", "length": 2}}
2023-10-06 10:06:22.848 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":6, "data":"BF0000000000"}, "id": 0}
2023-10-06 10:06:22.849 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BF0000000000
2023-10-06 10:06:22.849 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentStationsActiveResponse', 'pageNumber': 0, 'activeStations': 0}
2023-10-06 10:06:22.849 DEBUG (MainThread) [pyrainbird.async_client] Request (CurrentRainSensorStateRequest): 3E
2023-10-06 10:06:22.849 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696579582.8491552, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "3E", "length": 1}}
2023-10-06 10:06:23.186 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":2, "data":"BE00"}, "id": 0}
2023-10-06 10:06:23.186 DEBUG (MainThread) [pyrainbird.async_client] Response from line: BE00
2023-10-06 10:06:23.186 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'CurrentRainSensorStateResponse', 'sensorState': 0}
2023-10-06 10:06:23.186 DEBUG (MainThread) [pyrainbird.async_client] Request (RainDelayGetRequest): 36
2023-10-06 10:06:23.186 DEBUG (MainThread) [pyrainbird.async_client] Request: {"id": 1696579583.186419, "jsonrpc": "2.0", "method": "tunnelSip", "params": {"data": "36", "length": 1}}
2023-10-06 10:06:23.541 DEBUG (MainThread) [pyrainbird.async_client] Response: {"jsonrpc": "2.0", "result":{"length":3, "data":"B60001"}, "id": 0}
2023-10-06 10:06:23.542 DEBUG (MainThread) [pyrainbird.async_client] Response from line: B60001
2023-10-06 10:06:23.542 DEBUG (MainThread) [pyrainbird.async_client] Response: {'type': 'RainDelaySettingResponse', 'delaySetting': 1}
2023-10-06 10:06:23.542 DEBUG (MainThread) [homeassistant.components.rainbird.coordinator] Finished fetching 10.144.1.121 data in 1.446 seconds (success: True)
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
2023-10-06 10:06:23.545 DEBUG (MainThread) [homeassistant.components.rainbird.switch] coordinator.unique_id=None
```
BTW, one additional observation. After applying the fix to the instance where Rainbird was already set up I could see now new entities created, working ok, but not linked to the integration. Here is how it looks like. Those in the red status are the ones linked to the integration but not working:
![image](https://github.com/home-assistant/core/assets/19752098/5640603d-766e-4d6e-81ba-75835d6cb8c2)

Hi,

I hit the same issue. My previous devices and entites are still linked to the integration, but they are no longer provided so they don't work. I got new entities (but no devices) created by the integration that work just fine, but are not linked to the integration or any device:

![image](https://github.com/home-assistant/core/assets/615268/13239c56-e982-4664-a824-95b64cf2f8f0)

Also, new entities do not have a unique ID, so they can't be configured from the UI (icon, name, etc.).

Will the fix take back old entities or will keep the new ones?

Thanks!
Yeah, unfortunatly this fix doesn't seem to adress all the issues. Should this bug then be reopened?
Rainbird devices with a zero serial number dont have a unique id so they will not be able to work from the UI going forward. The entities are all there but not UI editable.  (Like it used to be). This needed to be fixed do that users could add multiple devices (another issue reported by users).

The fix I submitted will make it keep working if you did have it editable.

If you delete the integration and re add it then they won't be editable from the UI anymore and the fix won't apply anymore.

There may be other ways to give these devices a unique id be using another identifier likesc address but it may require cloud rpcs which are not used today. 

I will look closer at the details you reported here.
@allenporter Do i understand that correct that right now, this leaves existing users with an inoperable setup or they need to stay on the previous HA version? As i understand it, there is no way to make it work like it used to, even with this patch, correct?
Oh, now I get it. Maybe as the easiest way we could simply take the IP address of the controller (or better MAC address if possible)? And anyway even if we can't have the unique IDs would be good to keep existing entity_ids for controllers that are already integrated with HA.



Fix (patch):
diff --git a/homeassistant/components/rainbird/calendar.py b/homeassistant/components/rainbird/calendar.py
index 356f7d7cc4e4c1..2001a14ac93dd7 100644
--- a/homeassistant/components/rainbird/calendar.py
+++ b/homeassistant/components/rainbird/calendar.py
@@ -61,7 +61,7 @@ def __init__(
         """Create the Calendar event device."""
         super().__init__(coordinator)
         self._event: CalendarEvent | None = None
-        if unique_id:
+        if unique_id is not None:
             self._attr_unique_id = unique_id
             self._attr_device_info = device_info
         else:
diff --git a/homeassistant/components/rainbird/number.py b/homeassistant/components/rainbird/number.py
index 1e72fabafcd915..dd9664222b2f37 100644
--- a/homeassistant/components/rainbird/number.py
+++ b/homeassistant/components/rainbird/number.py
@@ -51,7 +51,7 @@ def __init__(
     ) -> None:
         """Initialize the Rain Bird sensor."""
         super().__init__(coordinator)
-        if coordinator.unique_id:
+        if coordinator.unique_id is not None:
             self._attr_unique_id = f"{coordinator.unique_id}-rain-delay"
             self._attr_device_info = coordinator.device_info
         else:
diff --git a/homeassistant/components/rainbird/sensor.py b/homeassistant/components/rainbird/sensor.py
index d44e7156cb50b6..84bf8cadb7b308 100644
--- a/homeassistant/components/rainbird/sensor.py
+++ b/homeassistant/components/rainbird/sensor.py
@@ -52,7 +52,7 @@ def __init__(
         """Initialize the Rain Bird sensor."""
         super().__init__(coordinator)
         self.entity_description = description
-        if coordinator.unique_id:
+        if coordinator.unique_id is not None:
             self._attr_unique_id = f"{coordinator.unique_id}-{description.key}"
             self._attr_device_info = coordinator.device_info
         else:
diff --git a/homeassistant/components/rainbird/switch.py b/homeassistant/components/rainbird/switch.py
index 62b3b0e9a8c282..da3979a27fd652 100644
--- a/homeassistant/components/rainbird/switch.py
+++ b/homeassistant/components/rainbird/switch.py
@@ -65,17 +65,18 @@ def __init__(
         """Initialize a Rain Bird Switch Device."""
         super().__init__(coordinator)
         self._zone = zone
-        if coordinator.unique_id:
+        _LOGGER.debug("coordinator.unique_id=%s", coordinator.unique_id)
+        if coordinator.unique_id is not None:
             self._attr_unique_id = f"{coordinator.unique_id}-{zone}"
         device_name = f"{MANUFACTURER} Sprinkler {zone}"
         if imported_name:
             self._attr_name = imported_name
             self._attr_has_entity_name = False
         else:
-            self._attr_name = None if coordinator.unique_id else device_name
+            self._attr_name = None if coordinator.unique_id is not None else device_name
             self._attr_has_entity_name = True
         self._duration_minutes = duration_minutes
-        if coordinator.unique_id and self._attr_unique_id:
+        if coordinator.unique_id is not None and self._attr_unique_id is not None:
             self._attr_device_info = DeviceInfo(
                 name=device_name,
                 identifiers={(DOMAIN, self._attr_unique_id)},