diff --git a/homeassistant/components/shelly/diagnostics.py b/homeassistant/components/shelly/diagnostics.py
index cac2bb2f16be4fe6ef9c0ecba2b3d613cec8d5a1..2a9699e0a0854e879410c054dfedf8e940b967d3 100644
--- a/homeassistant/components/shelly/diagnostics.py
+++ b/homeassistant/components/shelly/diagnostics.py
@@ -79,12 +79,14 @@ async def async_get_config_entry_diagnostics(
             device_settings = {
                 k: v for k, v in rpc_coordinator.device.config.items() if k in ["cloud"]
             }
-            ws_config = rpc_coordinator.device.config["ws"]
-            device_settings["ws_outbound_enabled"] = ws_config["enable"]
-            if ws_config["enable"]:
-                device_settings["ws_outbound_server_valid"] = bool(
-                    ws_config["server"] == get_rpc_ws_url(hass)
-                )
+            if not (ws_config := rpc_coordinator.device.config.get("ws", {})):
+                device_settings["ws_outbound"] = "not supported"
+            if (ws_outbound_enabled := ws_config.get("enable")) is not None:
+                device_settings["ws_outbound_enabled"] = ws_outbound_enabled
+                if ws_outbound_enabled:
+                    device_settings["ws_outbound_server_valid"] = bool(
+                        ws_config["server"] == get_rpc_ws_url(hass)
+                    )
             device_status = {
                 k: v
                 for k, v in rpc_coordinator.device.status.items()
diff --git a/tests/components/shelly/test_diagnostics.py b/tests/components/shelly/test_diagnostics.py
index 3826631c580db9625e14787d74a27273c49acc2b..d89f21f59920a36d2158f8f3851d96ce6f628515 100644
--- a/tests/components/shelly/test_diagnostics.py
+++ b/tests/components/shelly/test_diagnostics.py
@@ -194,3 +194,21 @@ async def test_rpc_config_entry_diagnostics_ws_outbound(
         result["device_settings"]["ws_outbound_server_valid"]
         == ws_outbound_server_valid
     )
+
+
+async def test_rpc_config_entry_diagnostics_no_ws(
+    hass: HomeAssistant,
+    hass_client: ClientSessionGenerator,
+    mock_rpc_device: Mock,
+    monkeypatch: pytest.MonkeyPatch,
+) -> None:
+    """Test config entry diagnostics for rpc device which doesn't support ws outbound."""
+    config = deepcopy(mock_rpc_device.config)
+    config.pop("ws")
+    monkeypatch.setattr(mock_rpc_device, "config", config)
+
+    entry = await init_integration(hass, 3)
+
+    result = await get_diagnostics_for_config_entry(hass, hass_client, entry)
+
+    assert result["device_settings"]["ws_outbound"] == "not supported"